[Pkg-javascript-commits] [node-acorn-object-spread] 01/02: New upstream version 1.0.0
Julien Puydt
julien.puydt at laposte.net
Fri Sep 8 04:45:01 UTC 2017
This is an automated email from the git hooks/post-receive script.
jpuydt-guest pushed a commit to branch master
in repository node-acorn-object-spread.
commit 9e4d0f22f34b01ff76411deb4d950cee07dd195c
Author: Julien Puydt <julien.puydt at laposte.net>
Date: Fri Sep 8 06:25:38 2017 +0200
New upstream version 1.0.0
---
LICENSE | 19 +++++++++++++++++++
index.js | 3 +++
inject.js | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
package.json | 22 ++++++++++++++++++++++
4 files changed, 94 insertions(+)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..e2742a4
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,19 @@
+Copyright (C) 2016 by UXtemple
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..58c8677
--- /dev/null
+++ b/index.js
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = require('./inject')(require('acorn'));
diff --git a/inject.js b/inject.js
new file mode 100644
index 0000000..424305c
--- /dev/null
+++ b/inject.js
@@ -0,0 +1,50 @@
+'use strict';
+
+module.exports = function(acorn) {
+ var tt = acorn.tokTypes;
+ var pp = acorn.Parser.prototype;
+
+ // this is the same parseObj that acorn has with...
+ function parseObj(isPattern, refDestructuringErrors) {
+ let node = this.startNode(), first = true, propHash = {}
+ node.properties = []
+ this.next()
+ while (!this.eat(tt.braceR)) {
+ if (!first) {
+ this.expect(tt.comma)
+ if (this.afterTrailingComma(tt.braceR)) break
+ } else first = false
+
+ let prop = this.startNode(), isGenerator, startPos, startLoc
+ if (this.options.ecmaVersion >= 6) {
+ // ...the spread logic borrowed from babylon :)
+ if (this.type === tt.ellipsis) {
+ prop = this.parseSpread()
+ prop.type = isPattern ? "RestProperty" : "SpreadProperty"
+ node.properties.push(prop)
+ continue
+ }
+
+ prop.method = false
+ prop.shorthand = false
+ if (isPattern || refDestructuringErrors) {
+ startPos = this.start
+ startLoc = this.startLoc
+ }
+ if (!isPattern)
+ isGenerator = this.eat(tt.star)
+ }
+ this.parsePropertyName(prop)
+ this.parsePropertyValue(prop, isPattern, isGenerator, startPos, startLoc, refDestructuringErrors)
+ this.checkPropClash(prop, propHash)
+ node.properties.push(this.finishNode(prop, "Property"))
+ }
+ return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
+ }
+
+ acorn.plugins.objectSpread = function objectSpreadPlugin(instance) {
+ pp.parseObj = parseObj;
+ };
+
+ return acorn;
+};
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..a3bac7e
--- /dev/null
+++ b/package.json
@@ -0,0 +1,22 @@
+{
+ "name": "acorn-object-spread",
+ "description": "Support object spread in acorn",
+ "homepage": "https://github.com/UXtemple/acorn-object-spread",
+ "author": "Darío Javier Cravero <dario at uxtemple.com>",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/UXtemple/acorn-object-spread"
+ },
+ "license": "MIT",
+ "scripts": {
+ "test": "node test/run.js"
+ },
+ "dependencies": {
+ "acorn": "^3.1.0"
+ },
+ "devDependencies": {
+ "chai": "^3.0.0",
+ "mocha": "^2.2.5"
+ },
+ "version": "1.0.0"
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-object-spread.git
More information about the Pkg-javascript-commits
mailing list