diff --git a/package-lock.json b/package-lock.json index 2f2c70df838be1..44064a0e60140d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2562,7 +2562,10 @@ } }, "@wordpress/block-serialization-spec-parser": { - "version": "file:packages/block-serialization-spec-parser" + "version": "file:packages/block-serialization-spec-parser", + "requires": { + "pegjs": "^0.10.0" + } }, "@wordpress/blocks": { "version": "file:packages/blocks", @@ -15873,8 +15876,7 @@ "pegjs": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.10.0.tgz", - "integrity": "sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0=", - "dev": true + "integrity": "sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0=" }, "pend": { "version": "1.2.0", diff --git a/packages/block-serialization-default-parser/test/index.js b/packages/block-serialization-default-parser/test/index.js index a3c67e280ef946..72f4121ce19445 100644 --- a/packages/block-serialization-default-parser/test/index.js +++ b/packages/block-serialization-default-parser/test/index.js @@ -6,7 +6,8 @@ import path from 'path'; /** * WordPress dependencies */ -import { jsTester, phpTester } from '@wordpress/block-serialization-spec-parser'; +// eslint-disable-next-line no-restricted-syntax +import { jsTester, phpTester } from '@wordpress/block-serialization-spec-parser/shared-tests'; /** * Internal dependencies diff --git a/packages/block-serialization-spec-parser/CHANGELOG.md b/packages/block-serialization-spec-parser/CHANGELOG.md index e4f403ffd68497..7ba44f0cd9a963 100644 --- a/packages/block-serialization-spec-parser/CHANGELOG.md +++ b/packages/block-serialization-spec-parser/CHANGELOG.md @@ -1,6 +1,12 @@ -## 2.1.0 (Unreleased) +## 3.0.0 (Unreleased) -- A `parser.php` file generated from the PEGJS grammar is now included. +## Breaking Change + +- A `parser.js` file generated from the PEGJS grammar is now outputted in commonjs format. + +## New Feature + +- A `parser.php` file generated from the PEGJS grammar is now added upon installation. ## 2.0.2 (2018-12-12) diff --git a/packages/block-serialization-spec-parser/index.js b/packages/block-serialization-spec-parser/index.js deleted file mode 100644 index b217f8f5c5ad76..00000000000000 --- a/packages/block-serialization-spec-parser/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { parse } from './parser'; -export { jsTester, phpTester } from './shared-tests'; diff --git a/packages/block-serialization-spec-parser/package.json b/packages/block-serialization-spec-parser/package.json index 918c269169f09f..5d40a8cfd03de1 100644 --- a/packages/block-serialization-spec-parser/package.json +++ b/packages/block-serialization-spec-parser/package.json @@ -18,12 +18,16 @@ "bugs": { "url": "https://github.com/WordPress/gutenberg/issues" }, + "main": "parser.js", + "dependencies": { + "pegjs": "^0.10.0" + }, "publishConfig": { "access": "public" }, "scripts": { "build": "concurrently \"npm run build:js\" \"npm run build:php\"", - "build:js": "pegjs --format umd -o ./parser.js ./grammar.pegjs", + "build:js": "pegjs --format commonjs -o ./parser.js ./grammar.pegjs", "build:php": "node bin/create-php-parser.js" } } diff --git a/packages/block-serialization-spec-parser/test/index.js b/packages/block-serialization-spec-parser/test/index.js index 7bdbe9f053f169..9d00c5a5434c33 100644 --- a/packages/block-serialization-spec-parser/test/index.js +++ b/packages/block-serialization-spec-parser/test/index.js @@ -6,7 +6,8 @@ import path from 'path'; /** * Internal dependencies */ -import { jsTester, phpTester, parse } from '../'; +import { parse } from '../'; +import { jsTester, phpTester } from '../shared-tests'; describe( 'block-serialization-spec-parser-js', jsTester( parse ) ); diff --git a/packages/scripts/config/webpack.config.js b/packages/scripts/config/webpack.config.js index 5dcaebe8a3770b..c92575423fec19 100644 --- a/packages/scripts/config/webpack.config.js +++ b/packages/scripts/config/webpack.config.js @@ -83,11 +83,7 @@ const config = { }, { test: /\.js$/, - exclude: [ - /block-serialization-spec-parser/, - /is-shallow-equal/, - /node_modules/, - ], + exclude: /node_modules/, use: require.resolve( 'babel-loader' ), }, ],