Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports['default'] = dynamicImport;
var _acorn = require('acorn');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) { Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } } /* eslint-disable no-underscore-dangle */
var DynamicImportKey = exports.DynamicImportKey = 'Import';
// NOTE: This allows `yield import()` to parse correctly.
_acorn.tokTypes._import.startsExpr = true;
function parseDynamicImport() {
var node = this.startNode();
this.next();
if (this.type !== _acorn.tokTypes.parenL) {
this.unexpected();
}
return this.finishNode(node, DynamicImportKey);
}
function parenAfter() {
return (/^(\s|\/\/.*|\/\*[^]*?\*\/)*\(/.test(this.input.slice(this.pos))
);
}
function dynamicImport(Parser) {
/* Generated by `npm run build`, do not edit! */
"use strict"
var acorn = require("acorn")
var tt = acorn.tokTypes
var isIdentifierStart = acorn.isIdentifierStart
module.exports = function(Parser) {
return /*@__PURE__*/(function (Parser) {
function anonymous () {
Parser.apply(this, arguments);
}
if ( Parser ) anonymous.__proto__ = Parser;
anonymous.prototype = Object.create( Parser && Parser.prototype );
anonymous.prototype.constructor = anonymous;
anonymous.prototype.parseLiteral = function parseLiteral (value) {
var node = Parser.prototype.parseLiteral.call(this, value)
if (node.raw.charCodeAt(node.raw.length - 1) == 110) { node.bigint = this.getNumberInput(node.start, node.end) }
return node
var acorn = require("acorn");
var Token = acorn.Token;
var eofTokenType = acorn.tokTypes.eof;
var importTokenType = acorn.tokTypes._import;
var exportTokenType = acorn.tokTypes._export;
var importExportPattern = /\b(import|export)\b/g;
var assign = require("./utils.js").assign;
var Parser = acorn.Parser;
var parserOptions = {
ecmaVersion: 7,
sourceType: "module",
allowImportExportEverywhere: true,
allowReturnOutsideFunction: true,
allowHashBang: true
};
// TODO Could this be cached in memory?
exports.parse = function (code) {
var nodes = [];
var match;
var lastMatchIndex = -1;
function run(code) {
let result
if (!tokenize) {
try { result = acorn.parse(code, options) }
catch(e) { console.error(e.message); process.exit(1) }
} else {
result = []
let tokenizer = acorn.tokenizer(code, options), token
while (true) {
try { token = tokenizer.getToken() }
catch(e) { console.error(e.message); process.exit(1) }
result.push(token)
if (token.type == acorn.tokTypes.eof) break
}
}
if (!silent) console.log(JSON.stringify(result, null, compact ? null : 2))
}
function run(code) {
let result
if (!tokenize) {
try { result = acorn.parse(code, options) }
catch(e) { console.error(e.message); process.exit(1) }
} else {
result = []
let tokenizer = acorn.tokenizer(code, options), token
while (true) {
try { token = tokenizer.getToken() }
catch(e) { console.error(e.message); process.exit(1) }
result.push(token)
if (token.type == acorn.tokTypes.eof) break
}
}
if (!silent) console.log(JSON.stringify(result, null, compact ? null : 2))
}
const acorn = require("acorn");
const tt = acorn.tokTypes;
const isIdentifierChar = acorn.isIdentifierChar;
const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
const lineBreak = /\r\n?|\n|\u2028|\u2029/;
module.exports = function HzParserFactory(Parser) {
return class HzSpawnParser extends Parser {
parseMaybeAssign(noIn, refDestructuringErrors) {
return this.parseMaybeSpawn(noIn, refDestructuringErrors);
}
parseMaybeSpawn(noIn, refDestructuringErrors) {
skipWhiteSpace.lastIndex = this.pos;
const next = this.pos + skipWhiteSpace.exec(this.input)[0].length;
if (
!this.isContextual("spawn")
|| lineBreak.test(this.input.slice(this.pos, next))
|| this.input.slice(next, next + 1) === "="
|| !isIdentifierChar(this.input[next].charCodeAt(0))
'use strict';
const XHTMLEntities = require('./xhtml');
const hexNumber = /^[\da-fA-F]+$/;
const decimalNumber = /^\d+$/;
const acorn = require("acorn");
const tt = acorn.tokTypes;
const TokContext = acorn.TokContext;
const tokContexts = acorn.tokContexts;
const TokenType = acorn.TokenType;
const isNewLine = acorn.isNewLine;
const isIdentifierStart = acorn.isIdentifierStart;
const isIdentifierChar = acorn.isIdentifierChar;
const tc_oTag = new TokContext('...', true, true);
const tok = {
jsxName: new TokenType('jsxName'),
jsxText: new TokenType('jsxText', {beforeExpr: true}),
jsxTagStart: new TokenType('jsxTagStart'),
jsxTagEnd: new TokenType('jsxTagEnd')
/*
* Written by Kris Oye
* Copyright (C) 2017. All rights reserved.
* Date: October 1, 2017
*
* Eventually this might allow for access modifier keywords
* like 'public', 'private', and 'protected'.
*/
const acorn = require('acorn');
const
tt = acorn.tokTypes,
TokContext = acorn.TokContext,
TokenType = acorn.TokenType;
const
kmcCallOther = new TokContext('->', false);
const
tokenTypes = {
kmudCallOther: new TokenType('KMUDCallOther')
};
function plugin(options, Parser) {
return class extends Parser {
parseClassElement(constructorAllowsSuper) {
if (this.eat(tt.semi)) return null;
const onToken = ({ start, end, type }) => {
if (pos !== start) {
squashRegion(pos, start, pos === 0, type === acorn.tokTypes.eof);
}
pos = end;
};
function parseDynamicImport() {
var node = this.startNode();
this.next();
if (this.type !== _acorn.tokTypes.parenL) {
this.unexpected();
}
return this.finishNode(node, DynamicImportKey);
}