progress on migrating to heex templates and font-icons
This commit is contained in:
parent
d43daafdb7
commit
3eff955672
21793 changed files with 2161968 additions and 16895 deletions
assets_old/node_modules/es-module-lexer
60
assets_old/node_modules/es-module-lexer/CHANGELOG.md
generated
vendored
Executable file
60
assets_old/node_modules/es-module-lexer/CHANGELOG.md
generated
vendored
Executable file
|
@ -0,0 +1,60 @@
|
|||
0.4.1
|
||||
* Add TypeScript types (https://github.com/guybedford/es-module-lexer/pull/63, https://github.com/guybedford/es-module-lexer/pull/64 @xiaoxiangmoe)
|
||||
* Better export detection before bailing on `=` (https://github.com/guybedford/es-module-lexer/pull/66)
|
||||
|
||||
0.4.0
|
||||
* Adds support for .n property with unescaped specifier string (https://github.com/guybedford/es-module-lexer/pull/62)
|
||||
* Only use atob global in browser environments (https://github.com/guybedford/es-module-lexer/pull/58)
|
||||
|
||||
0.3.13
|
||||
* Fix comment support in export var statements (https://github.com/guybedford/es-module-lexer/pull/35)
|
||||
|
||||
0.3.12
|
||||
* Fix empty export statement handling (https://github.com/guybedford/es-module-lexer/pull/32)
|
||||
* Add Binaryen optimization passes to reduce file size (https://github.com/guybedford/es-module-lexer/pull/33)
|
||||
|
||||
0.3.11
|
||||
* Fixup parse error column handling (https://github.com/guybedford/es-module-lexer/commit/3979105162c50827af00dc4549944d708896da53)
|
||||
* Fix non-terminating loop case (https://github.com/guybedford/es-module-lexer/pull/31)
|
||||
|
||||
0.3.10
|
||||
* Better parse errors (https://github.com/guybedford/es-module-lexer/pull/30)
|
||||
* Handle end offset correctly (https://github.com/guybedford/es-module-lexer/pull/29)
|
||||
|
||||
0.3.9
|
||||
* Better invalid state handling (https://github.com/guybedford/es-module-lexer/pull/28)
|
||||
* Handle allocations for large numbers of exports (https://github.com/guybedford/es-module-lexer/pull/27)
|
||||
|
||||
0.3.8
|
||||
* Fix template parsing bug (https://github.com/guybedford/es-module-lexer/pull/22)
|
||||
|
||||
0.3.7
|
||||
* Refactoring (https://github.com/guybedford/es-module-lexer/pull/20, https://github.com/guybedford/es-module-lexer/pull/21)
|
||||
|
||||
0.3.6
|
||||
* Fix case where methods named import would be incorrectly reported as dynamic imports (https://github.com/guybedford/es-module-lexer/pull/19)
|
||||
|
||||
0.3.5
|
||||
* Fix Node.js 10 memory grow support for globals without a value getter (https://github.com/guybedford/es-module-lexer/issues/14)
|
||||
|
||||
0.3.4
|
||||
* Use UTF16 encoding for better performance, and removing reliance on TextEncoder (https://github.com/guybedford/es-module-lexer/pull/15)
|
||||
|
||||
0.3.3
|
||||
* Minification improvements
|
||||
* Fix for TextEncoder global being missing in Node.js 10
|
||||
* Fix CJS build to end in .cjs extension for modules compatibility
|
||||
|
||||
0.3.2
|
||||
* Fix export declaration parse bugs (https://github.com/guybedford/es-module-lexer/pull/11)
|
||||
|
||||
0.3.1
|
||||
* Fix up the ESM and CJS interfaces to use named exports
|
||||
|
||||
0.3.0
|
||||
* Web Assembly conversion for performance (https://github.com/guybedford/es-module-lexer/pull/7)
|
||||
* Fix $ characters in templates (https://github.com/guybedford/es-module-lexer/pull/6, @LarsDenBakker)
|
||||
* Fix comment handling in imports (https://github.com/guybedford/es-module-lexer/issues/8)
|
||||
|
||||
0.2.0
|
||||
* Include CJS build (https://github.com/guybedford/es-module-lexer/pull/1, @LarsDenBakker)
|
10
assets_old/node_modules/es-module-lexer/LICENSE
generated
vendored
Executable file
10
assets_old/node_modules/es-module-lexer/LICENSE
generated
vendored
Executable file
|
@ -0,0 +1,10 @@
|
|||
MIT License
|
||||
-----------
|
||||
|
||||
Copyright (C) 2018-2019 Guy Bedford
|
||||
|
||||
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.
|
195
assets_old/node_modules/es-module-lexer/README.md
generated
vendored
Executable file
195
assets_old/node_modules/es-module-lexer/README.md
generated
vendored
Executable file
|
@ -0,0 +1,195 @@
|
|||
# ES Module Lexer
|
||||
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
|
||||
A JS module syntax lexer used in [es-module-shims](https://github.com/guybedford/es-module-shims).
|
||||
|
||||
Outputs the list of exports and locations of import specifiers, including dynamic import and import meta handling.
|
||||
|
||||
A very small single JS file (4KiB gzipped) that includes inlined Web Assembly for very fast source analysis of ECMAScript module syntax only.
|
||||
|
||||
For an example of the performance, Angular 1 (720KiB) is fully parsed in 5ms, in comparison to the fastest JS parser, Acorn which takes over 100ms.
|
||||
|
||||
_Comprehensively handles the JS language grammar while remaining small and fast. - ~10ms per MB of JS cold and ~5ms per MB of JS warm, [see benchmarks](#benchmarks) for more info._
|
||||
|
||||
### Usage
|
||||
|
||||
```
|
||||
npm install es-module-lexer
|
||||
```
|
||||
|
||||
For use in CommonJS:
|
||||
|
||||
```js
|
||||
const { init, parse } = require('es-module-lexer');
|
||||
|
||||
(async () => {
|
||||
// either await init, or call parse asynchronously
|
||||
// this is necessary for the Web Assembly boot
|
||||
await init;
|
||||
|
||||
const [imports, exports] = parse('export var p = 5');
|
||||
exports[0] === 'p';
|
||||
})();
|
||||
```
|
||||
|
||||
An ES module version is also available from `dist/lexer.js`:
|
||||
Note: This version will be automatically used in rollup/es-dev-server/node (if an es-module project)
|
||||
|
||||
```js
|
||||
import { init, parse } from 'es-module-lexer/dist/lexer.js';
|
||||
|
||||
(async () => {
|
||||
await init;
|
||||
|
||||
const source = `
|
||||
import { a } from 'asdf';
|
||||
export var p = 5;
|
||||
export function q () {
|
||||
|
||||
};
|
||||
|
||||
// Comments provided to demonstrate edge cases
|
||||
import /*comment!*/ ('asdf');
|
||||
import /*comment!*/.meta.asdf;
|
||||
`;
|
||||
|
||||
const [imports, exports] = parse(source, 'optional-sourcename');
|
||||
|
||||
// Returns "asdf"
|
||||
imports[0].n
|
||||
source.substring(imports[0].s, imports[0].e);
|
||||
// "s" is shorthand for "start"
|
||||
// "e" is shorthand for "end"
|
||||
|
||||
// Returns "import { a } from 'asdf';"
|
||||
source.substring(imports[0].ss, imports[0].se);
|
||||
// "ss" is shorthand for "statement start"
|
||||
// "se" is shorthand for "statement end"
|
||||
|
||||
// Returns "p,q"
|
||||
exports.toString();
|
||||
|
||||
// Dynamic imports are indicated by imports[1].d > -1
|
||||
// In this case the "d" index is the start of the dynamic import
|
||||
// Returns true
|
||||
imports[1].d > -1;
|
||||
|
||||
// Returns "asdf"
|
||||
imports[1].n
|
||||
source.substring(imports[1].s, imports[1].e);
|
||||
// Returns "import /*comment!*/ ("
|
||||
source.substring(imports[1].d, imports[1].s);
|
||||
// Returns "import /*comment!*/ ('asdf')"
|
||||
source.substring(imports[1].d, imports[1].e + 1);
|
||||
// imports[1].ss and imports[1].se is not meaningful
|
||||
// because dynamic import is not a statement
|
||||
|
||||
// import.meta is indicated by imports[2].d === -2
|
||||
// Returns true
|
||||
imports[2].d === -2;
|
||||
// Returns "import /*comment!*/.meta"
|
||||
source.substring(imports[2].s, imports[2].e);
|
||||
})();
|
||||
```
|
||||
|
||||
### Escape Sequences
|
||||
|
||||
To handle escape sequences in specifier strings, the `.n` field of imported specifiers will be provided where possible.
|
||||
|
||||
For dynamic import expressions, this field will be empty if not a valid JS string.
|
||||
|
||||
### Facade Detection
|
||||
|
||||
Facade modules that only use import / export syntax can be detected via the third return value:
|
||||
|
||||
```js
|
||||
const [,, facade] = parse(`
|
||||
export * from 'external';
|
||||
import * as ns from 'external2';
|
||||
export { a as b } from 'external3';
|
||||
export { ns };
|
||||
`);
|
||||
facade === true;
|
||||
```
|
||||
|
||||
### Environment Support
|
||||
|
||||
Node.js 10+, and [all browsers with Web Assembly support](https://caniuse.com/#feat=wasm).
|
||||
|
||||
### Grammar Support
|
||||
|
||||
* Token state parses all line comments, block comments, strings, template strings, blocks, parens and punctuators.
|
||||
* Division operator / regex token ambiguity is handled via backtracking checks against punctuator prefixes, including closing brace or paren backtracking.
|
||||
* Always correctly parses valid JS source, but may parse invalid JS source without errors.
|
||||
|
||||
### Limitations
|
||||
|
||||
The lexing approach is designed to deal with the full language grammar including RegEx / division operator ambiguity through backtracking and paren / brace tracking.
|
||||
|
||||
The only limitation to the reduced parser is that the "exports" list may not correctly gather all export identifiers in the following edge cases:
|
||||
|
||||
```js
|
||||
// Only "a" is detected as an export, "q" isn't
|
||||
export var a = 'asdf', q = z;
|
||||
|
||||
// "b" is not detected as an export
|
||||
export var { a: b } = asdf;
|
||||
```
|
||||
|
||||
The above cases are handled gracefully in that the lexer will keep going fine, it will just not properly detect the export names above.
|
||||
|
||||
### Benchmarks
|
||||
|
||||
Benchmarks can be run with `npm run bench`.
|
||||
|
||||
Current results:
|
||||
|
||||
```
|
||||
Module load time
|
||||
> 7ms
|
||||
Cold Run, All Samples
|
||||
test/samples/*.js (3057 KiB)
|
||||
> 33ms
|
||||
|
||||
Warm Runs (average of 25 runs)
|
||||
test/samples/angular.js (719 KiB)
|
||||
> 4.08ms
|
||||
test/samples/angular.min.js (188 KiB)
|
||||
> 2.08ms
|
||||
test/samples/d3.js (491 KiB)
|
||||
> 4.72ms
|
||||
test/samples/d3.min.js (274 KiB)
|
||||
> 3ms
|
||||
test/samples/magic-string.js (34 KiB)
|
||||
> 0.04ms
|
||||
test/samples/magic-string.min.js (20 KiB)
|
||||
> 0ms
|
||||
test/samples/rollup.js (902 KiB)
|
||||
> 8.16ms
|
||||
test/samples/rollup.min.js (429 KiB)
|
||||
> 4.28ms
|
||||
|
||||
Warm Runs, All Samples (average of 25 runs)
|
||||
test/samples/*.js (3057 KiB)
|
||||
> 25.68ms
|
||||
```
|
||||
|
||||
### Building
|
||||
|
||||
To build download the WASI SDK from https://github.com/WebAssembly/wasi-sdk/releases.
|
||||
|
||||
The Makefile assumes the existence of "wasi-sdk-11.0" and "wabt" (optional) as sibling folders to this project.
|
||||
|
||||
The build through the Makefile is then run via `make lib/lexer.wasm`, which can also be triggered via `npm run build-wasm` to create `dist/lexer.js`.
|
||||
|
||||
On Windows it may be preferable to use the Linux subsystem.
|
||||
|
||||
After the Web Assembly build, the CJS build can be triggered via `npm run build`.
|
||||
|
||||
### License
|
||||
|
||||
MIT
|
||||
|
||||
[travis-url]: https://travis-ci.org/guybedford/es-module-lexer
|
||||
[travis-image]: https://travis-ci.org/guybedford/es-module-lexer.svg?branch=master
|
1
assets_old/node_modules/es-module-lexer/dist/lexer.cjs
generated
vendored
Normal file
1
assets_old/node_modules/es-module-lexer/dist/lexer.cjs
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
assets_old/node_modules/es-module-lexer/dist/lexer.js
generated
vendored
Normal file
2
assets_old/node_modules/es-module-lexer/dist/lexer.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
39
assets_old/node_modules/es-module-lexer/package.json
generated
vendored
Executable file
39
assets_old/node_modules/es-module-lexer/package.json
generated
vendored
Executable file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"name": "es-module-lexer",
|
||||
"version": "0.4.1",
|
||||
"description": "Lexes ES modules returning their import/export metadata",
|
||||
"main": "dist/lexer.cjs",
|
||||
"module": "dist/lexer.js",
|
||||
"types": "types/lexer.d.ts",
|
||||
"scripts": {
|
||||
"test": "NODE_OPTIONS=\"--experimental-modules\" mocha -b -u tdd test/*.cjs",
|
||||
"build": "node --experimental-modules build.js && babel dist/lexer.js | terser -o dist/lexer.cjs",
|
||||
"build-wasm": "make lib/lexer.wasm && node build.js",
|
||||
"bench": "node --experimental-modules --expose-gc bench/index.js",
|
||||
"prepublishOnly": "npm run build",
|
||||
"footprint": "npm run build && cat dist/lexer.js | gzip -9f | wc -c"
|
||||
},
|
||||
"author": "Guy Bedford",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.5.5",
|
||||
"@babel/core": "^7.5.5",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.5.0",
|
||||
"kleur": "^2.0.2",
|
||||
"mocha": "^5.2.0",
|
||||
"terser": "^4.1.4"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"types"
|
||||
],
|
||||
"type": "module",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/guybedford/es-module-lexer.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/guybedford/es-module-lexer/issues"
|
||||
},
|
||||
"homepage": "https://github.com/guybedford/es-module-lexer#readme"
|
||||
}
|
79
assets_old/node_modules/es-module-lexer/types/lexer.d.ts
generated
vendored
Normal file
79
assets_old/node_modules/es-module-lexer/types/lexer.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
|||
export interface ImportSpecifier {
|
||||
/**
|
||||
* Module name
|
||||
*
|
||||
* To handle escape sequences in specifier strings, the .n field of imported specifiers will be provided where possible.
|
||||
*
|
||||
* For dynamic import expressions, this field will be empty if not a valid JS string.
|
||||
*
|
||||
* @example
|
||||
* const [imports1, exports1] = parse(String.raw`import './\u0061\u0062.js'`);
|
||||
* imports1[0].n;
|
||||
* // Returns "./ab.js"
|
||||
*
|
||||
* const [imports2, exports2] = parse(`import("./ab.js")`);
|
||||
* imports2[0].n;
|
||||
* // Returns "./ab.js"
|
||||
*
|
||||
* const [imports3, exports3] = parse(`import("./" + "ab.js")`);
|
||||
* imports3[0].n;
|
||||
* // Returns undefined
|
||||
*/
|
||||
readonly n: string | undefined;
|
||||
/**
|
||||
* Start of module specifier
|
||||
*
|
||||
* @example
|
||||
* const source = `import { a } from 'asdf'`;
|
||||
* const [imports, exports] = parse(source);
|
||||
* source.substring(imports[0].s, imports[0].e);
|
||||
* // Returns "asdf"
|
||||
*/
|
||||
readonly s: number;
|
||||
/**
|
||||
* End of module specifier
|
||||
*/
|
||||
readonly e: number;
|
||||
|
||||
/**
|
||||
* Start of import statement
|
||||
*
|
||||
* @example
|
||||
* const source = `import { a } from 'asdf'`;
|
||||
* const [imports, exports] = parse(source);
|
||||
* source.substring(imports[0].s, imports[0].e);
|
||||
* // Returns "import { a } from 'asdf';"
|
||||
*/
|
||||
readonly ss: number;
|
||||
/**
|
||||
* End of import statement
|
||||
*/
|
||||
readonly se: number;
|
||||
|
||||
/**
|
||||
* If this import statement is a dynamic import, this is the start value.
|
||||
* Otherwise this is `-1`.
|
||||
*/
|
||||
readonly d: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for init to resolve before calling `parse`.
|
||||
*/
|
||||
export const init: Promise<void>;
|
||||
|
||||
/**
|
||||
* Outputs the list of exports and locations of import specifiers,
|
||||
* including dynamic import and import meta handling.
|
||||
*
|
||||
* @param source Source code to parser
|
||||
* @param name Optional sourcename
|
||||
* @returns Tuple contaning imports list and exports list.
|
||||
*/
|
||||
export function parse(
|
||||
source: string,
|
||||
name?: string
|
||||
): readonly [
|
||||
imports: ReadonlyArray<ImportSpecifier>,
|
||||
exports: ReadonlyArray<string>
|
||||
];
|
Loading…
Add table
Add a link
Reference in a new issue