@wordpress/block-serialization-spec-parser 2.0.4 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 3.0.0 (Unreleased)
2
+
3
+ ## Breaking Change
4
+
5
+ - A `parser.js` file generated from the PEGJS grammar is now outputted in commonjs format.
6
+
7
+ ## New Feature
8
+
9
+ - A `parser.php` file generated from the PEGJS grammar is now added upon installation.
10
+
1
11
  ## 2.0.2 (2018-12-12)
2
12
 
3
13
  ## 2.0.1 (2018-11-30)
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ### WordPress - Web publishing software
2
2
 
3
- Copyright 2011-2018 by the contributors
3
+ Copyright 2011-2019 by the contributors
4
4
 
5
5
  This program is free software; you can redistribute it and/or modify
6
6
  it under the terms of the GNU General Public License as published by
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+
3
+ const pegjs = require( 'pegjs' );
4
+ const phpegjs = require( 'phpegjs' );
5
+ const fs = require( 'fs' );
6
+ const path = require( 'path' );
7
+
8
+ const peg = fs.readFileSync( path.join( __dirname, '..', 'grammar.pegjs' ), 'utf8' );
9
+
10
+ const parser = pegjs.generate(
11
+ peg,
12
+ {
13
+ plugins: [ phpegjs ],
14
+ phpegjs: {
15
+ parserNamespace: null,
16
+ parserGlobalNamePrefix: 'Gutenberg_PEG_',
17
+ mbstringAllowed: false,
18
+ },
19
+ }
20
+ );
21
+
22
+ fs.writeFileSync(
23
+ path.join( __dirname, '..', 'parser.php' ),
24
+ parser
25
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-serialization-spec-parser",
3
- "version": "2.0.4",
3
+ "version": "3.0.1",
4
4
  "description": "Block serialization specification parser for WordPress posts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -13,15 +13,22 @@
13
13
  "homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/block-serialization-spec-parser/README.md",
14
14
  "repository": {
15
15
  "type": "git",
16
- "url": "https://github.com/WordPress/gutenberg.git"
16
+ "url": "https://github.com/WordPress/gutenberg.git",
17
+ "directory": "packages/block-serialization-spec-parser"
17
18
  },
18
19
  "bugs": {
19
20
  "url": "https://github.com/WordPress/gutenberg/issues"
20
21
  },
22
+ "main": "parser.js",
23
+ "dependencies": {
24
+ "pegjs": "^0.10.0"
25
+ },
21
26
  "publishConfig": {
22
27
  "access": "public"
23
28
  },
24
29
  "scripts": {
25
- "build": "pegjs --format umd -o ./parser.js ./grammar.pegjs"
30
+ "build": "concurrently \"npm run build:js\" \"npm run build:php\"",
31
+ "build:js": "pegjs --format commonjs -o ./parser.js ./grammar.pegjs",
32
+ "build:php": "node bin/create-php-parser.js"
26
33
  }
27
34
  }