更新前端静态网页获取方式,放弃使用后端获取api

This commit is contained in:
2025-09-09 10:47:51 +08:00
parent 6889ca37e5
commit 44a4f1bae1
25558 changed files with 2463152 additions and 153 deletions

839
frontend/node_modules/terser/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,839 @@
# Changelog
## v5.43.1
- Prevent niche optimizations that would move around block declarations
- Add `lhs_constants` to `CompressOptions` type (#1621)
## v5.43.0
- Do not wrap callbacks in parentheses (`wrap_func_args` format option is now false by default)
- Do not inline functions into for loops (for performance reasons)
## v5.42.0
- Improved performance in the parse step by adding a fast path for simple identifiers.
- Improved ESTree conversion
## v5.41.0
- fixed semicolon insertion between class fields, when the field names are number literals
- `keep_numbers` format option now works for bigint
- internal: correctly mark accessors' is_generator property
- internal: do not read or assign quote properties without need
- internal: add missing equivalent_to comparison
## v5.40.0
- Fix exporting AssignmentExpression (default assign pattern) to ESTree
- Fix ESTree output of object keys with quotes
- Fix handling of an ESTree empty `export {}` (#1601)
- Fix some `const` and `let` resulting from ESTree input (#1599)
## v5.39.2
- Fix crash when parsing bare `yield` inside a template string.
- Update internally used acorn version requirement
## v5.39.1
- Fix bitwise operations that could mix `BigInt` and `number`
## v5.39.0
- Remove unnecessary `console.assert` calls (#1590)
## v5.38.2
- internal: Flatten inheritance tree for object/class members
## v5.38.1
- Fix inlining non-call expressions into an `optional_call?.()`
## v5.38.0
- Remove `console` method-of-method calls (eg `console.log.apply()`) when `drop_console` option is used (#1585)
- Remove more object spreads, such as `{ ...void !0 }` (#1142)
## v5.37.0
- Reserved object properties from chrome extensions (domprops)
- Fix semicolon insertion between a class property without a semicolon `a` and a computed class property `["prop"]`
## v5.36.0
- Support import attributes `with` syntax
## v5.35.0
- Ensure parent directory exists when using --output on CLI (#1530)
## v5.34.1
- bump the rollup devDependency to disable CVE warnings (Terser was not affected)
## v5.34.0
- internal: stop assigning properties to objects they don't belong in
- internal: run compress tests in parallel
- `drop_console`: emit an empty function if the return value of `console.METHOD(...)` may be called.
## v5.33.0
- `reduce_vars` improved when dealing with hoisted function definitions (#1544)
## v5.32.0
- `import("module")` can now be input and output from ESTree AST (#1557)
- `BigInt` literals can now be input and output from ESTree AST (#1555)
- `typeof` an object or array (`typeof {}` and `typeof []`) can now be statically evaluated. (#1546)
## v5.31.6
- Retain side effects in a `case` when the expression is a sequence (comma) expression
## v5.31.5
- Revert v5.31.4, which created mysterious issues #1548, #1549
## v5.31.4 (reverted)
- drop_unused: drop classes which only have side effects in the `extends` part
## v5.31.3
- drop_unused: drop unused parameters from IIFEs in some more situations.
## v5.31.2
- drop_unused: scan variables in self-referential class declarations that contain side effects.
- Don't add parens to arrow function when it's the default for an argument (#1540)
- Update domprops (#1538)
## v5.31.1
- Allow drop-unused to drop the whole assignment (not just the assigned name) in more situations, in order to avoid duplication of long strings.
## v5.31.0
- Sync up property mangler exceptions with current contents of Firefox and Chrome environments
- Add more webcomponent properties to property mangler exceptions (#1525)
- Drop non-nullish constants in `...spreads` in objects (#1141)
## v5.30.4
- Fix parsing `#private in ...` when next to other operators
## v5.30.3
- Fix precedence of `#private in ...` operator
## v5.30.2
- Avoid optimizations inside computed keys, because they can cause js-engine-specific bugs.
## v5.30.1
- Removed useless `\` escapes for non-ascii characters
- Make modern identifier characters quoted for older environments (#1512)
## v5.30.0
- Improve removal of classes referring to themselves
## v5.29.2
- Make sure 'computed_props' creates string keys
- Take into account the evaluated size when inlining
## v5.29.1
- fix optimisation of all-bits mask check
## v5.29.0
- Re-releases previously reverted 5.28.0
- Fix crash while optimizing some bitwise ops
- (internal) Remove needless wrapper for from_moz (#1499)
## v5.28.1
(hotfix release)
- Reverts v5.28.0
## v5.28.0
- Optimise redundant or shrinkable bitwise operations (`|`, `^`, `&`, `>>`, `<<`)
- Evaluate some `BigInt` math operations
## v5.27.2
- Recognise `this` as a reference to the surrounding class in `drop_unused`. Closes #1472
## v5.27.1
- Fixed case where `collapse_vars` inlines `await` expressions into non-async functions.
## v5.27.0
- Created `minify_sync()` alternative to `minify()` since there's no async code left.
## v5.26.0
- Do not take the `/*#__PURE__*/` annotation into account when the `side_effects` compress option is off.
- The `preserve_annotations` option now automatically opts annotation comments in, instead of requiring the `comments` option to be configured for this.
- Refuse to parse empty parenthesized expressions (`()`)
## v5.25.0
- Regex properties added to reserved property mangler (#1471)
- `pure_new` option added to drop unused `new` expressions.
## v5.24.0
- Improve formatting performance in V8 by keeping a small work string and a large output string
## v5.23.0
- When top_retain will keep a variable assignment around, inline the assignee when it's shorter than the name (#1434)
- Remove empty class `static {}` blocks.
## v5.22.0
- Do not `unsafe`ly shorten expressions like a?.toString() when they're conditional.
- Avoid running drop_unused in nodes that aren't scopes. Fixes a rare crash.
- When 'module' is enabled, assume strict mode when figuring out scopes.
## v5.21.0
- Do not inline functions that would be retained in the toplevel (as this would cause code duplication).
- Fix precedence of arrow function and ternary operator when formatting output.
## v5.20.0
- Passing `minify()` zero files will now throw a clean exception (#1450)
- `drop_console` supports passing in an array of `console.*` method names (#1445)
- New DOM properties from the WebGPU API have been added for use in the property mangler (#1436)
- Internal code simplification (#1437)
## v5.19.4
- Prevent creating very deeply nested ternaries from a long list of `if..return`
- Prevent inlining classes into other functions, to avoid constructors being compared.
## v5.19.3
- Fix side effect detection of `optional?.chains`.
- Add roundRect to domprops.js (#1426)
## v5.19.2
- fix performance hit from avoiding HTML comments in the output
## v5.19.1
- Better avoid outputting `</script>` and HTML comments.
- Fix unused variables in class static blocks not being dropped correctly.
- Fix sourcemap names of methods that are `async` or `static`
## v5.19.0
- Allow `/*@__MANGLE_PROP__*/` annotation in `object.property`, in addition to property declarations.
## v5.18.2
- Stop using recursion in hoisted defuns fix.
## v5.18.1
- Fix major performance issue caused by hoisted defuns' scopes bugfix.
## v5.18.0
- Add new `/*@__MANGLE_PROP__*/` annotation, to mark properties that should be mangled.
## v5.17.7
- Update some dependencies
- Add consistent sorting for `v` RegExp flag
- Add `inert` DOM attribute to domprops
## v5.17.6
- Fixes to mozilla AST input and output, for class properties, private properties and static blocks
- Fix outputting a shorthand property in quotes when safari10 and ecma=2015 options are enabled
- `configurable` and `enumerable`, used in Object.defineProperty, added to domprops (#1393)
## v5.17.5
- Take into account the non-deferred bits of a class, such as static properties, while dropping unused code.
## v5.17.4
- Fix crash when trying to negate a class (`!class{}`)
- Avoid outputting comments between `yield`/`await` and its argument
- Fix detection of left-hand-side of assignment, to avoid optimizing it like any other expression in some edge cases
## v5.17.3
- Fix issue with trimming a static class property's contents accessing the class as `this`.
## v5.17.2
- Be less conservative when detecting use-before-definition of `var` in hoisted functions.
- Support unusual (but perfectly valid) initializers of for-in and for-of loops.
- Fix issue where hoisted function would be dropped if it was after a `continue` statement
## v5.17.1
- Fix evaluating `.length` when the source array might've been mutated
## v5.17.0
- Drop vestigial `= undefined` default argument in IIFE calls (#1366)
- Evaluate known arrays' `.length` property when statically determinable
- Add `@__KEY__` annotation to mangle string literals (#1365)
## v5.16.9
- Fix parentheses in output of optional chains (`a?.b`) (#1374)
- More documentation on source maps (#1368)
- New `lhs_constants` option, allowing to stop Terser from swapping comparison operands (#1361)
## v5.16.8
- Become even less conservative around function definitions for `reduce_vars`
- Fix parsing context of `import.meta` expressions such that method calls are allowed
## v5.16.6
- Become less conservative with analyzing function definitions for `reduce_vars`
- Parse `import.meta` as a real AST node and not an `object.property`
## v5.16.5
- Correctly handle AST transform functions that mutate children arrays
- Don't mutate the options object passed to Terser (#1342)
- Do not treat BigInt like a number
## v5.16.4
- Keep `(defaultArg = undefined) => ...`, because default args don't count for function length
- Prevent inlining variables into `?.` optional chains
- Avoid removing unused arguments while transforming
- Optimize iterating AST node lists
- Make sure `catch` and `finally` aren't children of `try` in the AST
- Use modern unicode property escapes (`\p{...}`) to parse identifiers when available
## v5.16.3
- Ensure function definitions, don't assume the values of variables defined after them.
## v5.16.2
- Fix sourcemaps with non-ascii characters (#1318)
- Support string module name and export * as (#1336)
- Do not move `let` out of `for` initializers, as it can change scoping
- Fix a corner case that would generate the invalid syntax `if (something) let x` ("let" in braceless if body)
- Knowledge of more native object properties (#1330)
- Got rid of Travis (#1323)
- Added semi-secret `asObject` sourcemap option to typescript defs (#1321)
## v5.16.1
- Properly handle references in destructurings (`const { [reference]: val } = ...`)
- Allow parsing of `.#privatefield` in nested classes
- Do not evaluate operations that return large strings if that would make the output code larger
- Make `collapse_vars` handle block scope correctly
- Internal improvements: Typos (#1311), more tests, small-scale refactoring
## v5.16.0
- Disallow private fields in object bodies (#1011)
- Parse `#privatefield in object` (#1279)
- Compress `#privatefield in object`
## v5.15.1
- Fixed missing parentheses around optional chains
- Avoid bare `let` or `const` as the bodies of `if` statements (#1253)
- Small internal fixes (#1271)
- Avoid inlining a class twice and creating two equivalent but `!==` classes.
## v5.15.0
- Basic support for ES2022 class static initializer blocks.
- Add `AudioWorkletNode` constructor options to domprops list (#1230)
- Make identity function inliner not inline `id(...expandedArgs)`
## v5.14.2
- Security fix for RegExps that should not be evaluated (regexp DDOS)
- Source maps improvements (#1211)
- Performance improvements in long property access evaluation (#1213)
## v5.14.1
- keep_numbers option added to TypeScript defs (#1208)
- Fixed parsing of nested template strings (#1204)
## v5.14.0
- Switched to @jridgewell/source-map for sourcemap generation (#1190, #1181)
- Fixed source maps with non-terminated segments (#1106)
- Enabled typescript types to be imported from the package (#1194)
- Extra DOM props have been added (#1191)
- Delete the AST while generating code, as a means to save RAM
## v5.13.1
- Removed self-assignments (`varname=varname`) (closes #1081)
- Separated inlining code (for inlining things into references, or removing IIFEs)
- Allow multiple identifiers with the same name in `var` destructuring (eg `var { a, a } = x`) (#1176)
## v5.13.0
- All calls to eval() were removed (#1171, #1184)
- `source-map` was updated to 0.8.0-beta.0 (#1164)
- NavigatorUAData was added to domprops to avoid property mangling (#1166)
## v5.12.1
- Fixed an issue with function definitions inside blocks (#1155)
- Fixed parens of `new` in some situations (closes #1159)
## v5.12.0
- `TERSER_DEBUG_DIR` environment variable
- @copyright comments are now preserved with the comments="some" option (#1153)
## v5.11.0
- Unicode code point escapes (`\u{abcde}`) are not emitted inside RegExp literals anymore (#1147)
- acorn is now a regular dependency
## v5.10.0
- Massive optimization to max_line_len (#1109)
- Basic support for import assertions
- Marked ES2022 Object.hasOwn as a pure function
- Fix `delete optional?.property`
- New CI/CD pipeline with github actions (#1057)
- Fix reordering of switch branches (#1092), (#1084)
- Fix error when creating a class property called `get`
- Acorn dependency is now an optional peerDependency
- Fix mangling collision with exported variables (#1072)
- Fix an issue with `return someVariable = (async () => { ... })()` (#1073)
## v5.9.0
- Collapsing switch cases with the same bodies (even if they're not next to each other) (#1070).
- Fix evaluation of optional chain expressions (#1062)
- Fix mangling collision in ESM exports (#1063)
- Fix issue with mutating function objects after a second pass (#1047)
- Fix for inlining object spread `{ ...obj }` (#1071)
- Typescript typings fix (#1069)
## v5.8.0
- Fixed shadowing variables while moving code in some cases (#1065)
- Stop mangling computed & quoted properties when keep_quoted is enabled.
- Fix for mangling private getter/setter and .#private access (#1060, #1068)
- Array.from has a new optimization when the unsafe option is set (#737)
- Mangle/propmangle let you generate your own identifiers through the nth_identifier option (#1061)
- More optimizations to switch statements (#1044)
## v5.7.2
- Fixed issues with compressing functions defined in `global_defs` option (#1036)
- New recipe for using Terser in gulp was added to RECIPES.md (#1035)
- Fixed issues with `??` and `?.` (#1045)
- Future reserved words such as `package` no longer require you to disable strict mode to be used as names.
- Refactored huge compressor file into multiple more focused files.
- Avoided unparenthesized `in` operator in some for loops (it breaks parsing because of for..in loops)
- Improved documentation (#1021, #1025)
- More type definitions (#1021)
## v5.7.1
- Avoided collapsing assignments together if it would place a chain assignment on the left hand side, which is invalid syntax (`a?.b = c`)
- Removed undefined from object expansions (`{ ...void 0 }` -> `{}`)
- Fix crash when checking if something is nullish or undefined (#1009)
- Fixed comparison of private class properties (#1015)
- Minor performance improvements (#993)
- Fixed scope of function defs in strict mode (they are block scoped)
## v5.7.0
- Several compile-time evaluation and inlining fixes
- Allow `reduce_funcs` to be disabled again.
- Add `spidermonkey` options to parse and format (#974)
- Accept `{get = "default val"}` and `{set = "default val"}` in destructuring arguments.
- Change package.json export map to help require.resolve (#971)
- Improve docs
- Fix `export default` of an anonymous class with `extends`
## v5.6.1
- Mark assignments to the `.prototype` of a class as pure
- Parenthesize `await` on the left of `**` (while accepting legacy non-parenthesised input)
- Avoided outputting NUL bytes in optimized RegExps, to stop the output from breaking other tools
- Added `exports` to domprops (#939)
- Fixed a crash when spreading `...this`
- Fixed the computed size of arrow functions, which improves their inlining
## v5.6.0
- Added top-level await
- Beautify option has been removed in #895
- Private properties, getters and setters have been added in #913 and some more commits
- Docs improvements: #896, #903, #916
## v5.5.1
- Fixed object properties with unicode surrogates on safari.
## v5.5.0
- Fixed crash when inlining uninitialized variable into template string.
- The sourcemap for dist was removed for being too large.
## v5.4.0
- Logical assignment
- Change `let x = undefined` to just `let x`
- Removed some optimizations for template strings, placing them behind `unsafe` options. Reason: adding strings is not equivalent to template strings, due to valueOf differences.
- The AST_Token class was slimmed down in order to use less memory.
## v5.3.8
- Restore node 13 support
## v5.3.7
Hotfix release, fixes package.json "engines" syntax
## v5.3.6
- Fixed parentheses when outputting `??` mixed with `||` and `&&`
- Improved hygiene of the symbol generator
## v5.3.5
- Avoid moving named functions into default exports.
- Enabled transform() for chain expressions. This allows AST transformers to reach inside chain expressions.
## v5.3.4
- Fixed a crash when hoisting (with `hoist_vars`) a destructuring variable declaration
## v5.3.3
- `source-map` library has been updated, bringing memory usage and CPU time improvements when reading input source maps (the SourceMapConsumer is now WASM based).
- The `wrap_func_args` option now also wraps arrow functions, as opposed to only function expressions.
## v5.3.2
- Prevented spread operations from being expanded when the expanded array/object contains getters, setters, or array holes.
- Fixed _very_ slow self-recursion in some cases of removing extraneous parentheses from `+` operations.
## v5.3.1
- An issue with destructuring declarations when `pure_getters` is enabled has been fixed
- Fixed a crash when chain expressions need to be shallowly compared
- Made inlining functions more conservative to make sure a function that contains a reference to itself isn't moved into a place that can create multiple instances of itself.
## v5.3.0
- Fixed a crash when compressing object spreads in some cases
- Fixed compiletime evaluation of optional chains (caused typeof a?.b to always return "object")
- domprops has been updated to contain every single possible prop
## v5.2.1
- The parse step now doesn't accept an `ecma` option, so that all ES code is accepted.
- Optional dotted chains now accept keywords, just like dotted expressions (`foo?.default`)
## v5.2.0
- Optional chaining syntax is now supported.
- Consecutive await expressions don't have unnecessary parens
- Taking the variable name's length (after mangling) into consideration when deciding to inline
## v5.1.0
- `import.meta` is now supported
- Typescript typings have been improved
## v5.0.0
- `in` operator now taken into account during property mangle.
- Fixed infinite loop in face of a reference loop in some situations.
- Kept exports and imports around even if there's something which will throw before them.
- The main exported bundle for commonjs, dist/bundle.min.js is no longer minified.
## v5.0.0-beta.0
- BREAKING: `minify()` is now async and rejects a promise instead of returning an error.
- BREAKING: Internal AST is no longer exposed, so that it can be improved without releasing breaking changes.
- BREAKING: Lowest supported node version is 10
- BREAKING: There are no more warnings being emitted
- Module is now distributed as a dual package - You can `import` and `require()` too.
- Inline improvements were made
-----
## v4.8.1 (backport)
- Security fix for RegExps that should not be evaluated (regexp DDOS)
## v4.8.0
- Support for numeric separators (`million = 1_000_000`) was added.
- Assigning properties to a class is now assumed to be pure.
- Fixed bug where `yield` wasn't considered a valid property key in generators.
## v4.7.0
- A bug was fixed where an arrow function would have the wrong size
- `arguments` object is now considered safe to retrieve properties from (useful for `length`, or `0`) even when `pure_getters` is not set.
- Fixed erroneous `const` declarations without value (which is invalid) in some corner cases when using `collapse_vars`.
## v4.6.13
- Fixed issue where ES5 object properties were being turned into ES6 object properties due to more lax unicode rules.
- Fixed parsing of BigInt with lowercase `e` in them.
## v4.6.12
- Fixed subtree comparison code, making it see that `[1,[2, 3]]` is different from `[1, 2, [3]]`
- Printing of unicode identifiers has been improved
## v4.6.11
- Read unused classes' properties and method keys, to figure out if they use other variables.
- Prevent inlining into block scopes when there are name collisions
- Functions are no longer inlined into parameter defaults, because they live in their own special scope.
- When inlining identity functions, take into account the fact they may be used to drop `this` in function calls.
- Nullish coalescing operator (`x ?? y`), plus basic optimization for it.
- Template literals in binary expressions such as `+` have been further optimized
## v4.6.10
- Do not use reduce_vars when classes are present
## v4.6.9
- Check if block scopes actually exist in blocks
## v4.6.8
- Take into account "executed bits" of classes like static properties or computed keys, when checking if a class evaluation might throw or have side effects.
## v4.6.7
- Some new performance gains through a `AST_Node.size()` method which measures a node's source code length without printing it to a string first.
- An issue with setting `--comments` to `false` in the CLI has been fixed.
- Fixed some issues with inlining
- `unsafe_symbols` compress option was added, which turns `Symbol("name")` into just `Symbol()`
- Brought back compress performance improvement through the `AST_Node.equivalent_to(other)` method (which was reverted in v4.6.6).
## v4.6.6
(hotfix release)
- Reverted code to 4.6.4 to allow for more time to investigate an issue.
## v4.6.5 (REVERTED)
- Improved compress performance through using a new method to see if two nodes are equivalent, instead of printing them to a string.
## v4.6.4
- The `"some"` value in the `comments` output option now preserves `@lic` and other important comments when using `//`
- `</script>` is now better escaped in regex, and in comments, when using the `inline_script` output option
- Fixed an issue when transforming `new RegExp` into `/.../` when slashes are included in the source
- `AST_Node.prototype.constructor` now exists, allowing for easier debugging of crashes
- Multiple if statements with the same consequents are now collapsed
- Typescript typings improvements
- Optimizations while looking for surrogate pairs in strings
## v4.6.3
- Annotations such as `/*#__NOINLINE__*/` and `/*#__PURE__*/` may now be preserved using the `preserve_annotations` output option
- A TypeScript definition update for the `keep_quoted` output option.
## v4.6.2
- A bug where functions were inlined into other functions with scope conflicts has been fixed.
- `/*#__NOINLINE__*/` annotation fixed for more use cases where inlining happens.
## v4.6.1
- Fixed an issue where a class is duplicated by reduce_vars when there's a recursive reference to the class.
## v4.6.0
- Fixed issues with recursive class references.
- BigInt evaluation has been prevented, stopping Terser from evaluating BigInts like it would do regular numbers.
- Class property support has been added
## v4.5.1
(hotfix release)
- Fixed issue where `() => ({})[something]` was not parenthesised correctly.
## v4.5.0
- Inlining has been improved
- An issue where keep_fnames combined with functions declared through variables was causing name shadowing has been fixed
- You can now set the ES version through their year
- The output option `keep_numbers` has been added, which prevents Terser from turning `1000` into `1e3` and such
- Internal small optimisations and refactors
## v4.4.3
- Number and BigInt parsing has been fixed
- `/*#__INLINE__*/` annotation fixed for arrow functions with non-block bodies.
- Functional tests have been added, using [this repository](https://github.com/terser/terser-functional-tests).
- A memory leak, where the entire AST lives on after compression, has been plugged.
## v4.4.2
- Fixed a problem with inlining identity functions
## v4.4.1
*note:* This introduced a feature, therefore it should have been a minor release.
- Fixed a crash when `unsafe` was enabled.
- An issue has been fixed where `let` statements might be collapsed out of their scope.
- Some error messages have been improved by adding quotes around variable names.
## v4.4.0
- Added `/*#__INLINE__*/` and `/*#__NOINLINE__*/` annotations for calls. If a call has one of these, it either forces or forbids inlining.
## v4.3.11
- Fixed a problem where `window` was considered safe to access, even though there are situations where it isn't (Node.js, workers...)
- Fixed an error where `++` and `--` were considered side-effect free
- `Number(x)` now needs both `unsafe` and and `unsafe_math` to be compressed into `+x` because `x` might be a `BigInt`
- `keep_fnames` now correctly supports regexes when the function is in a variable declaration
## v4.3.10
- Fixed syntax error when repeated semicolons were encountered in classes
- Fixed invalid output caused by the creation of empty sequences internally
- Scopes are now updated when scopes are inlined into them
## v4.3.9
- Fixed issue with mangle's `keep_fnames` option, introduced when adding code to keep variable names of anonymous functions
## v4.3.8
- Typescript typings fix
## v4.3.7
- Parsing of regex options in the CLI (which broke in v4.3.5) was fixed.
- typescript definition updates
## v4.3.6
(crash hotfix)
## v4.3.5
- Fixed an issue with DOS line endings strings separated by `\` and a new line.
- Improved fix for the output size regression related to unused references within the extends section of a class.
- Variable names of anonymous functions (eg: `const x = () => { ... }` or `var func = function () {...}`) are now preserved when keep_fnames is true.
- Fixed performance degradation introduced for large payloads in v4.2.0
## v4.3.4
- Fixed a regression where the output size was increased when unused classes were referred to in the extends clause of a class.
- Small typescript typings fixes.
- Comments with `@preserve`, `@license`, `@cc_on` as well as comments starting with `/*!` and `/**!` are now preserved by default.
## v4.3.3
- Fixed a problem where parsing template strings would mix up octal notation and a slash followed by a zero representing a null character.
- Started accepting the name `async` in destructuring arguments with default value.
- Now Terser takes into account side effects inside class `extends` clauses.
- Added parens whenever there's a comment between a return statement and the returned value, to prevent issues with ASI.
- Stopped using raw RegExp objects, since the spec is going to continue to evolve. This ensures Terser is able to process new, unknown RegExp flags and features. This is a breaking change in the AST node AST_RegExp.
## v4.3.2
- Typescript typing fix
- Ensure that functions can't be inlined, by reduce_vars, into places where they're accessing variables with the same name, but from somewhere else.
## v4.3.1
- Fixed an issue from 4.3.0 where any block scope within a for loop erroneously had its parent set to the function scopee
- Fixed an issue where compressing IIFEs with argument expansions would result in some parameters becoming undefined
- addEventListener options argument's properties are now part of the DOM properties list.
## v4.3.0
- Do not drop computed object keys with side effects
- Functions passed to other functions in calls are now wrapped in parentheses by default, which speeds up loading most modules
- Objects with computed properties are now less likely to be hoisted
- Speed and memory efficiency optimizations
- Fixed scoping issues with `try` and `switch`
## v4.2.1
- Minor refactors
- Fixed a bug similar to #369 in collapse_vars
- Functions can no longer be inlined into a place where they're going to be compared with themselves.
- reduce_funcs option is now legacy, as using reduce_vars without reduce_funcs caused some weird corner cases. As a result, it is now implied in reduce_vars and can't be turned off without turning off reduce_vars.
- Bug which would cause a random stack overflow has now been fixed.
## v4.2.0
- When the source map URL is `inline`, don't write it to a file.
- Fixed output parens when a lambda literal is the tag on a tagged template string.
- The `mangle.properties.undeclared` option was added. This enables the property mangler to mangle properties of variables which can be found in the name cache, but whose properties are not known to this Terser run.
- The v8 bug where the toString and source representations of regexes like `RegExp("\\\n")` includes an actual newline is now fixed.
- Now we're guaranteed to not have duplicate comments in the output
- Domprops updates
## v4.1.4
- Fixed a crash when inlining a function into somewhere else when it has interdependent, non-removable variables.
## v4.1.3
- Several issues with the `reduce_vars` option were fixed.
- Starting this version, we only have a dist/bundle.min.js
## v4.1.2
- The hotfix was hotfixed
## v4.1.1
- Fixed a bug where toplevel scopes were being mixed up with lambda scopes
## v4.1.0
- Internal functions were replaced by `Object.assign`, `Array.prototype.some`, `Array.prototype.find` and `Array.prototype.every`.
- A serious issue where some ESM-native code was broken was fixed.
- Performance improvements were made.
- Support for BigInt was added.
- Inline efficiency was improved. Functions are now being inlined more proactively instead of being inlined only after another Compressor pass.
## v4.0.2
(Hotfix release. Reverts unmapped segments PR [#342](https://github.com/terser/terser/pull/342), which will be put back on Terser when the upstream issue is resolved)
## v4.0.1
- Collisions between the arguments of inlined functions and names in the outer scope are now being avoided while inlining
- Unmapped segments are now preserved when compressing a file which has source maps
- Default values of functions are now correctly converted from Mozilla AST to Terser AST
- JSON ⊂ ECMAScript spec (if you don't know what this is you don't need to)
- Export AST_* classes to library users
- Fixed issue with `collapse_vars` when functions are created with the same name as a variable which already exists
- Added `MutationObserverInit` (Object with options for initialising a mutation observer) properties to the DOM property list
- Custom `Error` subclasses are now internally used instead of old-school Error inheritance hacks.
- Documentation fixes
- Performance optimizations
## v4.0.0
- **breaking change**: The `variables` property of all scopes has become a standard JavaScript `Map` as opposed to the old bespoke `Dictionary` object.
- Typescript definitions were fixed
- `terser --help` was fixed
- The public interface was cleaned up
- Fixed optimisation of `Array` and `new Array`
- Added the `keep_quoted=strict` mode to mangle_props, which behaves more like Google Closure Compiler by mangling all unquoted property names, instead of reserving quoted property names automatically.
- Fixed parent functions' parameters being shadowed in some cases
- Allowed Terser to run in a situation where there are custom functions attached to Object.prototype
- And more bug fixes, optimisations and internal changes
## v3.17.0
- More DOM properties added to --mangle-properties's DOM property list
- Closed issue where if 2 functions had the same argument name, Terser would not inline them together properly
- Fixed issue with `hasOwnProperty.call`
- You can now list files to minify in a Terser config file
- Started replacing `new Array(<number>)` with an array literal
- Started using ES6 capabilities like `Set` and the `includes` method for strings and arrays
## v3.16.1
- Fixed issue where Terser being imported with `import` would cause it not to work due to the `__esModule` property. (PR #254 was submitted, which was nice, but since it wasn't a pure commonJS approach I decided to go with my own solution)
## v3.16.0
- No longer leaves names like Array or Object or window as a SimpleStatement (statement which is just a single expression).
- Add support for sections sourcemaps (IndexedSourceMapConsumer)
- Drops node.js v4 and starts using commonJS
- Is now built with rollup
## v3.15.0
- Inlined spread syntax (`[...[1, 2, 3], 4, 5] => [1, 2, 3, 4, 5]`) in arrays and objects.
- Fixed typo in compressor warning
- Fixed inline source map input bug
- Fixed parsing of template literals with unnecessary escapes (Like `\\a`)

27
frontend/node_modules/terser/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,27 @@
Copyright 2012-2018 (c) Mihai Bazon <mihai.bazon@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

15
frontend/node_modules/terser/PATRONS.md generated vendored Normal file
View File

@@ -0,0 +1,15 @@
# Our patrons
These are the first-tier patrons from Patreon (notice: **The Terser Patreon is shutting down in favor of opencollective**). My appreciation goes to everyone on this list for supporting the project!
* 38elements
* Alan Orozco
* Aria Buckles
* CKEditor
* Mariusz Nowak
* Nakshatra Mukhopadhyay
* Philippe Léger
* Piotrek Koszuliński
* Serhiy Shyyko
* Viktor Hubert
* 龙腾道

1419
frontend/node_modules/terser/README.md generated vendored Normal file

File diff suppressed because it is too large Load Diff

10
frontend/node_modules/terser/bin/package.json generated vendored Normal file
View File

@@ -0,0 +1,10 @@
{
"name": "bin",
"private": true,
"version": "1.0.0",
"main": "terser",
"type": "commonjs",
"author": "",
"license": "BSD-2-Clause",
"description": "A package to hold the Terser bin bundle as commonjs while keeping the rest of it ESM."
}

21
frontend/node_modules/terser/bin/terser generated vendored Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env node
"use strict";
require("../tools/exit.cjs");
try {
require("source-map-support").install();
} catch (err) {}
const fs = require("fs");
const path = require("path");
const program = require("commander");
const packageJson = require("../package.json");
const { _run_cli: run_cli } = require("..");
run_cli({ program, packageJson, fs, path }).catch((error) => {
console.error(error);
process.exitCode = 1;
});

10
frontend/node_modules/terser/bin/uglifyjs generated vendored Executable file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env node
// -*- js -*-
/* eslint-env node */
"use strict";
process.stderr.write( "DEPRECATION WARNING: uglifyjs binary will soon be discontinued!\n");
process.stderr.write("Please use \"terser\" instead.\n\n");
require("./terser");

27
frontend/node_modules/terser/main.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import "./lib/transform.js";
import "./lib/mozilla-ast.js";
import { minify } from "./lib/minify.js";
export { minify, minify_sync } from "./lib/minify.js";
export { run_cli as _run_cli } from "./lib/cli.js";
export async function _default_options() {
const defs = {};
Object.keys(infer_options({ 0: 0 })).forEach((component) => {
const options = infer_options({
[component]: {0: 0}
});
if (options) defs[component] = options;
});
return defs;
}
async function infer_options(options) {
try {
await minify("", options);
} catch (error) {
return error.defs;
}
}

View File

@@ -0,0 +1,419 @@
2.20.3 / 2019-10-11
==================
* Support Node.js 0.10 (Revert #1059)
* Ran "npm unpublish commander@2.20.2". There is no 2.20.2.
2.20.1 / 2019-09-29
==================
* Improve executable subcommand tracking
* Update dev dependencies
2.20.0 / 2019-04-02
==================
* fix: resolve symbolic links completely when hunting for subcommands (#935)
* Update index.d.ts (#930)
* Update Readme.md (#924)
* Remove --save option as it isn't required anymore (#918)
* Add link to the license file (#900)
* Added example of receiving args from options (#858)
* Added missing semicolon (#882)
* Add extension to .eslintrc (#876)
2.19.0 / 2018-10-02
==================
* Removed newline after Options and Commands headers (#864)
* Bugfix - Error output (#862)
* Fix to change default value to string (#856)
2.18.0 / 2018-09-07
==================
* Standardize help output (#853)
* chmod 644 travis.yml (#851)
* add support for execute typescript subcommand via ts-node (#849)
2.17.1 / 2018-08-07
==================
* Fix bug in command emit (#844)
2.17.0 / 2018-08-03
==================
* fixed newline output after help information (#833)
* Fix to emit the action even without command (#778)
* npm update (#823)
2.16.0 / 2018-06-29
==================
* Remove Makefile and `test/run` (#821)
* Make 'npm test' run on Windows (#820)
* Add badge to display install size (#807)
* chore: cache node_modules (#814)
* chore: remove Node.js 4 (EOL), add Node.js 10 (#813)
* fixed typo in readme (#812)
* Fix types (#804)
* Update eslint to resolve vulnerabilities in lodash (#799)
* updated readme with custom event listeners. (#791)
* fix tests (#794)
2.15.0 / 2018-03-07
==================
* Update downloads badge to point to graph of downloads over time instead of duplicating link to npm
* Arguments description
2.14.1 / 2018-02-07
==================
* Fix typing of help function
2.14.0 / 2018-02-05
==================
* only register the option:version event once
* Fixes issue #727: Passing empty string for option on command is set to undefined
* enable eqeqeq rule
* resolves #754 add linter configuration to project
* resolves #560 respect custom name for version option
* document how to override the version flag
* document using options per command
2.13.0 / 2018-01-09
==================
* Do not print default for --no-
* remove trailing spaces in command help
* Update CI's Node.js to LTS and latest version
* typedefs: Command and Option types added to commander namespace
2.12.2 / 2017-11-28
==================
* fix: typings are not shipped
2.12.1 / 2017-11-23
==================
* Move @types/node to dev dependency
2.12.0 / 2017-11-22
==================
* add attributeName() method to Option objects
* Documentation updated for options with --no prefix
* typings: `outputHelp` takes a string as the first parameter
* typings: use overloads
* feat(typings): update to match js api
* Print default value in option help
* Fix translation error
* Fail when using same command and alias (#491)
* feat(typings): add help callback
* fix bug when description is add after command with options (#662)
* Format js code
* Rename History.md to CHANGELOG.md (#668)
* feat(typings): add typings to support TypeScript (#646)
* use current node
2.11.0 / 2017-07-03
==================
* Fix help section order and padding (#652)
* feature: support for signals to subcommands (#632)
* Fixed #37, --help should not display first (#447)
* Fix translation errors. (#570)
* Add package-lock.json
* Remove engines
* Upgrade package version
* Prefix events to prevent conflicts between commands and options (#494)
* Removing dependency on graceful-readlink
* Support setting name in #name function and make it chainable
* Add .vscode directory to .gitignore (Visual Studio Code metadata)
* Updated link to ruby commander in readme files
2.10.0 / 2017-06-19
==================
* Update .travis.yml. drop support for older node.js versions.
* Fix require arguments in README.md
* On SemVer you do not start from 0.0.1
* Add missing semi colon in readme
* Add save param to npm install
* node v6 travis test
* Update Readme_zh-CN.md
* Allow literal '--' to be passed-through as an argument
* Test subcommand alias help
* link build badge to master branch
* Support the alias of Git style sub-command
* added keyword commander for better search result on npm
* Fix Sub-Subcommands
* test node.js stable
* Fixes TypeError when a command has an option called `--description`
* Update README.md to make it beginner friendly and elaborate on the difference between angled and square brackets.
* Add chinese Readme file
2.9.0 / 2015-10-13
==================
* Add option `isDefault` to set default subcommand #415 @Qix-
* Add callback to allow filtering or post-processing of help text #434 @djulien
* Fix `undefined` text in help information close #414 #416 @zhiyelee
2.8.1 / 2015-04-22
==================
* Back out `support multiline description` Close #396 #397
2.8.0 / 2015-04-07
==================
* Add `process.execArg` support, execution args like `--harmony` will be passed to sub-commands #387 @DigitalIO @zhiyelee
* Fix bug in Git-style sub-commands #372 @zhiyelee
* Allow commands to be hidden from help #383 @tonylukasavage
* When git-style sub-commands are in use, yet none are called, display help #382 @claylo
* Add ability to specify arguments syntax for top-level command #258 @rrthomas
* Support multiline descriptions #208 @zxqfox
2.7.1 / 2015-03-11
==================
* Revert #347 (fix collisions when option and first arg have same name) which causes a bug in #367.
2.7.0 / 2015-03-09
==================
* Fix git-style bug when installed globally. Close #335 #349 @zhiyelee
* Fix collisions when option and first arg have same name. Close #346 #347 @tonylukasavage
* Add support for camelCase on `opts()`. Close #353 @nkzawa
* Add node.js 0.12 and io.js to travis.yml
* Allow RegEx options. #337 @palanik
* Fixes exit code when sub-command failing. Close #260 #332 @pirelenito
* git-style `bin` files in $PATH make sense. Close #196 #327 @zhiyelee
2.6.0 / 2014-12-30
==================
* added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee
* Add application description to the help msg. Close #112 @dalssoft
2.5.1 / 2014-12-15
==================
* fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee
2.5.0 / 2014-10-24
==================
* add support for variadic arguments. Closes #277 @whitlockjc
2.4.0 / 2014-10-17
==================
* fixed a bug on executing the coercion function of subcommands option. Closes #270
* added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage
* added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage
* fixed a bug on subcommand name. Closes #248 @jonathandelgado
* fixed function normalize doesnt honor option terminator. Closes #216 @abbr
2.3.0 / 2014-07-16
==================
* add command alias'. Closes PR #210
* fix: Typos. Closes #99
* fix: Unused fs module. Closes #217
2.2.0 / 2014-03-29
==================
* add passing of previous option value
* fix: support subcommands on windows. Closes #142
* Now the defaultValue passed as the second argument of the coercion function.
2.1.0 / 2013-11-21
==================
* add: allow cflag style option params, unit test, fixes #174
2.0.0 / 2013-07-18
==================
* remove input methods (.prompt, .confirm, etc)
1.3.2 / 2013-07-18
==================
* add support for sub-commands to co-exist with the original command
1.3.1 / 2013-07-18
==================
* add quick .runningCommand hack so you can opt-out of other logic when running a sub command
1.3.0 / 2013-07-09
==================
* add EACCES error handling
* fix sub-command --help
1.2.0 / 2013-06-13
==================
* allow "-" hyphen as an option argument
* support for RegExp coercion
1.1.1 / 2012-11-20
==================
* add more sub-command padding
* fix .usage() when args are present. Closes #106
1.1.0 / 2012-11-16
==================
* add git-style executable subcommand support. Closes #94
1.0.5 / 2012-10-09
==================
* fix `--name` clobbering. Closes #92
* fix examples/help. Closes #89
1.0.4 / 2012-09-03
==================
* add `outputHelp()` method.
1.0.3 / 2012-08-30
==================
* remove invalid .version() defaulting
1.0.2 / 2012-08-24
==================
* add `--foo=bar` support [arv]
* fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]
1.0.1 / 2012-08-03
==================
* fix issue #56
* fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())
1.0.0 / 2012-07-05
==================
* add support for optional option descriptions
* add defaulting of `.version()` to package.json's version
0.6.1 / 2012-06-01
==================
* Added: append (yes or no) on confirmation
* Added: allow node.js v0.7.x
0.6.0 / 2012-04-10
==================
* Added `.prompt(obj, callback)` support. Closes #49
* Added default support to .choose(). Closes #41
* Fixed the choice example
0.5.1 / 2011-12-20
==================
* Fixed `password()` for recent nodes. Closes #36
0.5.0 / 2011-12-04
==================
* Added sub-command option support [itay]
0.4.3 / 2011-12-04
==================
* Fixed custom help ordering. Closes #32
0.4.2 / 2011-11-24
==================
* Added travis support
* Fixed: line-buffered input automatically trimmed. Closes #31
0.4.1 / 2011-11-18
==================
* Removed listening for "close" on --help
0.4.0 / 2011-11-15
==================
* Added support for `--`. Closes #24
0.3.3 / 2011-11-14
==================
* Fixed: wait for close event when writing help info [Jerry Hamlet]
0.3.2 / 2011-11-01
==================
* Fixed long flag definitions with values [felixge]
0.3.1 / 2011-10-31
==================
* Changed `--version` short flag to `-V` from `-v`
* Changed `.version()` so it's configurable [felixge]
0.3.0 / 2011-10-31
==================
* Added support for long flags only. Closes #18
0.2.1 / 2011-10-24
==================
* "node": ">= 0.4.x < 0.7.0". Closes #20
0.2.0 / 2011-09-26
==================
* Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
0.1.0 / 2011-08-24
==================
* Added support for custom `--help` output
0.0.5 / 2011-08-18
==================
* Changed: when the user enters nothing prompt for password again
* Fixed issue with passwords beginning with numbers [NuckChorris]
0.0.4 / 2011-08-15
==================
* Fixed `Commander#args`
0.0.3 / 2011-08-15
==================
* Added default option value support
0.0.2 / 2011-08-15
==================
* Added mask support to `Command#password(str[, mask], fn)`
* Added `Command#password(str, fn)`
0.0.1 / 2010-01-03
==================
* Initial release

View File

@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
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.

View File

@@ -0,0 +1,428 @@
# Commander.js
[![Build Status](https://api.travis-ci.org/tj/commander.js.svg?branch=master)](http://travis-ci.org/tj/commander.js)
[![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://npmcharts.com/compare/commander?minimal=true)
[![Install Size](https://packagephobia.now.sh/badge?p=commander)](https://packagephobia.now.sh/result?p=commander)
[![Join the chat at https://gitter.im/tj/commander.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tj/commander.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/commander-rb/commander).
[API documentation](http://tj.github.com/commander.js/)
## Installation
$ npm install commander
## Option parsing
Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
```js
#!/usr/bin/env node
/**
* Module dependencies.
*/
var program = require('commander');
program
.version('0.1.0')
.option('-p, --peppers', 'Add peppers')
.option('-P, --pineapple', 'Add pineapple')
.option('-b, --bbq-sauce', 'Add bbq sauce')
.option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
.parse(process.argv);
console.log('you ordered a pizza with:');
if (program.peppers) console.log(' - peppers');
if (program.pineapple) console.log(' - pineapple');
if (program.bbqSauce) console.log(' - bbq');
console.log(' - %s cheese', program.cheese);
```
Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
Note that multi-word options starting with `--no` prefix negate the boolean value of the following word. For example, `--no-sauce` sets the value of `program.sauce` to false.
```js
#!/usr/bin/env node
/**
* Module dependencies.
*/
var program = require('commander');
program
.option('--no-sauce', 'Remove sauce')
.parse(process.argv);
console.log('you ordered a pizza');
if (program.sauce) console.log(' with sauce');
else console.log(' without sauce');
```
To get string arguments from options you will need to use angle brackets <> for required inputs or square brackets [] for optional inputs.
e.g. ```.option('-m --myarg [myVar]', 'my super cool description')```
Then to access the input if it was passed in.
e.g. ```var myInput = program.myarg```
**NOTE**: If you pass a argument without using brackets the example above will return true and not the value passed in.
## Version option
Calling the `version` implicitly adds the `-V` and `--version` options to the command.
When either of these options is present, the command prints the version number and exits.
$ ./examples/pizza -V
0.0.1
If you want your program to respond to the `-v` option instead of the `-V` option, simply pass custom flags to the `version` method using the same syntax as the `option` method.
```js
program
.version('0.0.1', '-v, --version')
```
The version flags can be named anything, but the long option is required.
## Command-specific options
You can attach options to a command.
```js
#!/usr/bin/env node
var program = require('commander');
program
.command('rm <dir>')
.option('-r, --recursive', 'Remove recursively')
.action(function (dir, cmd) {
console.log('remove ' + dir + (cmd.recursive ? ' recursively' : ''))
})
program.parse(process.argv)
```
A command's options are validated when the command is used. Any unknown options will be reported as an error. However, if an action-based command does not define an action, then the options are not validated.
## Coercion
```js
function range(val) {
return val.split('..').map(Number);
}
function list(val) {
return val.split(',');
}
function collect(val, memo) {
memo.push(val);
return memo;
}
function increaseVerbosity(v, total) {
return total + 1;
}
program
.version('0.1.0')
.usage('[options] <file ...>')
.option('-i, --integer <n>', 'An integer argument', parseInt)
.option('-f, --float <n>', 'A float argument', parseFloat)
.option('-r, --range <a>..<b>', 'A range', range)
.option('-l, --list <items>', 'A list', list)
.option('-o, --optional [value]', 'An optional value')
.option('-c, --collect [value]', 'A repeatable value', collect, [])
.option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)
.parse(process.argv);
console.log(' int: %j', program.integer);
console.log(' float: %j', program.float);
console.log(' optional: %j', program.optional);
program.range = program.range || [];
console.log(' range: %j..%j', program.range[0], program.range[1]);
console.log(' list: %j', program.list);
console.log(' collect: %j', program.collect);
console.log(' verbosity: %j', program.verbose);
console.log(' args: %j', program.args);
```
## Regular Expression
```js
program
.version('0.1.0')
.option('-s --size <size>', 'Pizza size', /^(large|medium|small)$/i, 'medium')
.option('-d --drink [drink]', 'Drink', /^(coke|pepsi|izze)$/i)
.parse(process.argv);
console.log(' size: %j', program.size);
console.log(' drink: %j', program.drink);
```
## Variadic arguments
The last argument of a command can be variadic, and only the last argument. To make an argument variadic you have to
append `...` to the argument name. Here is an example:
```js
#!/usr/bin/env node
/**
* Module dependencies.
*/
var program = require('commander');
program
.version('0.1.0')
.command('rmdir <dir> [otherDirs...]')
.action(function (dir, otherDirs) {
console.log('rmdir %s', dir);
if (otherDirs) {
otherDirs.forEach(function (oDir) {
console.log('rmdir %s', oDir);
});
}
});
program.parse(process.argv);
```
An `Array` is used for the value of a variadic argument. This applies to `program.args` as well as the argument passed
to your action as demonstrated above.
## Specify the argument syntax
```js
#!/usr/bin/env node
var program = require('commander');
program
.version('0.1.0')
.arguments('<cmd> [env]')
.action(function (cmd, env) {
cmdValue = cmd;
envValue = env;
});
program.parse(process.argv);
if (typeof cmdValue === 'undefined') {
console.error('no command given!');
process.exit(1);
}
console.log('command:', cmdValue);
console.log('environment:', envValue || "no environment given");
```
Angled brackets (e.g. `<cmd>`) indicate required input. Square brackets (e.g. `[env]`) indicate optional input.
## Git-style sub-commands
```js
// file: ./examples/pm
var program = require('commander');
program
.version('0.1.0')
.command('install [name]', 'install one or more packages')
.command('search [query]', 'search with optional query')
.command('list', 'list packages installed', {isDefault: true})
.parse(process.argv);
```
When `.command()` is invoked with a description argument, no `.action(callback)` should be called to handle sub-commands, otherwise there will be an error. This tells commander that you're going to use separate executables for sub-commands, much like `git(1)` and other popular tools.
The commander will try to search the executables in the directory of the entry script (like `./examples/pm`) with the name `program-command`, like `pm-install`, `pm-search`.
Options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the subcommand from the generated help output. Specifying `true` for `opts.isDefault` will run the subcommand if no other subcommand is specified.
If the program is designed to be installed globally, make sure the executables have proper modes, like `755`.
### `--harmony`
You can enable `--harmony` option in two ways:
* Use `#! /usr/bin/env node --harmony` in the sub-commands scripts. Note some os version dont support this pattern.
* Use the `--harmony` option when call the command, like `node --harmony examples/pm publish`. The `--harmony` option will be preserved when spawning sub-command process.
## Automated --help
The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
```
$ ./examples/pizza --help
Usage: pizza [options]
An application for pizzas ordering
Options:
-h, --help output usage information
-V, --version output the version number
-p, --peppers Add peppers
-P, --pineapple Add pineapple
-b, --bbq Add bbq sauce
-c, --cheese <type> Add the specified type of cheese [marble]
-C, --no-cheese You do not want any cheese
```
## Custom help
You can display arbitrary `-h, --help` information
by listening for "--help". Commander will automatically
exit once you are done so that the remainder of your program
does not execute causing undesired behaviors, for example
in the following executable "stuff" will not output when
`--help` is used.
```js
#!/usr/bin/env node
/**
* Module dependencies.
*/
var program = require('commander');
program
.version('0.1.0')
.option('-f, --foo', 'enable some foo')
.option('-b, --bar', 'enable some bar')
.option('-B, --baz', 'enable some baz');
// must be before .parse() since
// node's emit() is immediate
program.on('--help', function(){
console.log('')
console.log('Examples:');
console.log(' $ custom-help --help');
console.log(' $ custom-help -h');
});
program.parse(process.argv);
console.log('stuff');
```
Yields the following help output when `node script-name.js -h` or `node script-name.js --help` are run:
```
Usage: custom-help [options]
Options:
-h, --help output usage information
-V, --version output the version number
-f, --foo enable some foo
-b, --bar enable some bar
-B, --baz enable some baz
Examples:
$ custom-help --help
$ custom-help -h
```
## .outputHelp(cb)
Output help information without exiting.
Optional callback cb allows post-processing of help text before it is displayed.
If you want to display help by default (e.g. if no command was provided), you can use something like:
```js
var program = require('commander');
var colors = require('colors');
program
.version('0.1.0')
.command('getstream [url]', 'get stream URL')
.parse(process.argv);
if (!process.argv.slice(2).length) {
program.outputHelp(make_red);
}
function make_red(txt) {
return colors.red(txt); //display the help text in red on the console
}
```
## .help(cb)
Output help information and exit immediately.
Optional callback cb allows post-processing of help text before it is displayed.
## Custom event listeners
You can execute custom actions by listening to command and option events.
```js
program.on('option:verbose', function () {
process.env.VERBOSE = this.verbose;
});
// error on unknown commands
program.on('command:*', function () {
console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args.join(' '));
process.exit(1);
});
```
## Examples
```js
var program = require('commander');
program
.version('0.1.0')
.option('-C, --chdir <path>', 'change the working directory')
.option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
.option('-T, --no-tests', 'ignore test hook');
program
.command('setup [env]')
.description('run setup commands for all envs')
.option("-s, --setup_mode [mode]", "Which setup mode to use")
.action(function(env, options){
var mode = options.setup_mode || "normal";
env = env || 'all';
console.log('setup for %s env(s) with %s mode', env, mode);
});
program
.command('exec <cmd>')
.alias('ex')
.description('execute the given remote cmd')
.option("-e, --exec_mode <mode>", "Which exec mode to use")
.action(function(cmd, options){
console.log('exec "%s" using %s mode', cmd, options.exec_mode);
}).on('--help', function() {
console.log('');
console.log('Examples:');
console.log('');
console.log(' $ deploy exec sequential');
console.log(' $ deploy exec async');
});
program
.command('*')
.action(function(env){
console.log('deploying "%s"', env);
});
program.parse(process.argv);
```
More Demos can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory.
## License
[MIT](https://github.com/tj/commander.js/blob/master/LICENSE)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
{
"name": "commander",
"version": "2.20.3",
"description": "the complete solution for node.js command-line programs",
"keywords": [
"commander",
"command",
"option",
"parser"
],
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/tj/commander.js.git"
},
"scripts": {
"lint": "eslint index.js",
"test": "node test/run.js && npm run test-typings",
"test-typings": "tsc -p tsconfig.json"
},
"main": "index",
"files": [
"index.js",
"typings/index.d.ts"
],
"dependencies": {},
"devDependencies": {
"@types/node": "^12.7.8",
"eslint": "^6.4.0",
"should": "^13.2.3",
"sinon": "^7.5.0",
"standard": "^14.3.1",
"ts-node": "^8.4.1",
"typescript": "^3.6.3"
},
"typings": "typings/index.d.ts"
}

View File

@@ -0,0 +1,310 @@
// Type definitions for commander 2.11
// Project: https://github.com/visionmedia/commander.js
// Definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>, Jules Randolph <https://github.com/sveinburne>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace local {
class Option {
flags: string;
required: boolean;
optional: boolean;
bool: boolean;
short?: string;
long: string;
description: string;
/**
* Initialize a new `Option` with the given `flags` and `description`.
*
* @param {string} flags
* @param {string} [description]
*/
constructor(flags: string, description?: string);
}
class Command extends NodeJS.EventEmitter {
[key: string]: any;
args: string[];
/**
* Initialize a new `Command`.
*
* @param {string} [name]
*/
constructor(name?: string);
/**
* Set the program version to `str`.
*
* This method auto-registers the "-V, --version" flag
* which will print the version number when passed.
*
* @param {string} str
* @param {string} [flags]
* @returns {Command} for chaining
*/
version(str: string, flags?: string): Command;
/**
* Add command `name`.
*
* The `.action()` callback is invoked when the
* command `name` is specified via __ARGV__,
* and the remaining arguments are applied to the
* function for access.
*
* When the `name` is "*" an un-matched command
* will be passed as the first arg, followed by
* the rest of __ARGV__ remaining.
*
* @example
* program
* .version('0.0.1')
* .option('-C, --chdir <path>', 'change the working directory')
* .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
* .option('-T, --no-tests', 'ignore test hook')
*
* program
* .command('setup')
* .description('run remote setup commands')
* .action(function() {
* console.log('setup');
* });
*
* program
* .command('exec <cmd>')
* .description('run the given remote command')
* .action(function(cmd) {
* console.log('exec "%s"', cmd);
* });
*
* program
* .command('teardown <dir> [otherDirs...]')
* .description('run teardown commands')
* .action(function(dir, otherDirs) {
* console.log('dir "%s"', dir);
* if (otherDirs) {
* otherDirs.forEach(function (oDir) {
* console.log('dir "%s"', oDir);
* });
* }
* });
*
* program
* .command('*')
* .description('deploy the given env')
* .action(function(env) {
* console.log('deploying "%s"', env);
* });
*
* program.parse(process.argv);
*
* @param {string} name
* @param {string} [desc] for git-style sub-commands
* @param {CommandOptions} [opts] command options
* @returns {Command} the new command
*/
command(name: string, desc?: string, opts?: commander.CommandOptions): Command;
/**
* Define argument syntax for the top-level command.
*
* @param {string} desc
* @returns {Command} for chaining
*/
arguments(desc: string): Command;
/**
* Parse expected `args`.
*
* For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
*
* @param {string[]} args
* @returns {Command} for chaining
*/
parseExpectedArgs(args: string[]): Command;
/**
* Register callback `fn` for the command.
*
* @example
* program
* .command('help')
* .description('display verbose help')
* .action(function() {
* // output help here
* });
*
* @param {(...args: any[]) => void} fn
* @returns {Command} for chaining
*/
action(fn: (...args: any[]) => void): Command;
/**
* Define option with `flags`, `description` and optional
* coercion `fn`.
*
* The `flags` string should contain both the short and long flags,
* separated by comma, a pipe or space. The following are all valid
* all will output this way when `--help` is used.
*
* "-p, --pepper"
* "-p|--pepper"
* "-p --pepper"
*
* @example
* // simple boolean defaulting to false
* program.option('-p, --pepper', 'add pepper');
*
* --pepper
* program.pepper
* // => Boolean
*
* // simple boolean defaulting to true
* program.option('-C, --no-cheese', 'remove cheese');
*
* program.cheese
* // => true
*
* --no-cheese
* program.cheese
* // => false
*
* // required argument
* program.option('-C, --chdir <path>', 'change the working directory');
*
* --chdir /tmp
* program.chdir
* // => "/tmp"
*
* // optional argument
* program.option('-c, --cheese [type]', 'add cheese [marble]');
*
* @param {string} flags
* @param {string} [description]
* @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default
* @param {*} [defaultValue]
* @returns {Command} for chaining
*/
option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command;
option(flags: string, description?: string, defaultValue?: any): Command;
/**
* Allow unknown options on the command line.
*
* @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options.
* @returns {Command} for chaining
*/
allowUnknownOption(arg?: boolean): Command;
/**
* Parse `argv`, settings options and invoking commands when defined.
*
* @param {string[]} argv
* @returns {Command} for chaining
*/
parse(argv: string[]): Command;
/**
* Parse options from `argv` returning `argv` void of these options.
*
* @param {string[]} argv
* @returns {ParseOptionsResult}
*/
parseOptions(argv: string[]): commander.ParseOptionsResult;
/**
* Return an object containing options as key-value pairs
*
* @returns {{[key: string]: any}}
*/
opts(): { [key: string]: any };
/**
* Set the description to `str`.
*
* @param {string} str
* @param {{[argName: string]: string}} argsDescription
* @return {(Command | string)}
*/
description(str: string, argsDescription?: {[argName: string]: string}): Command;
description(): string;
/**
* Set an alias for the command.
*
* @param {string} alias
* @return {(Command | string)}
*/
alias(alias: string): Command;
alias(): string;
/**
* Set or get the command usage.
*
* @param {string} str
* @return {(Command | string)}
*/
usage(str: string): Command;
usage(): string;
/**
* Set the name of the command.
*
* @param {string} str
* @return {Command}
*/
name(str: string): Command;
/**
* Get the name of the command.
*
* @return {string}
*/
name(): string;
/**
* Output help information for this command.
*
* @param {(str: string) => string} [cb]
*/
outputHelp(cb?: (str: string) => string): void;
/** Output help information and exit.
*
* @param {(str: string) => string} [cb]
*/
help(cb?: (str: string) => string): never;
}
}
declare namespace commander {
type Command = local.Command
type Option = local.Option
interface CommandOptions {
noHelp?: boolean;
isDefault?: boolean;
}
interface ParseOptionsResult {
args: string[];
unknown: string[];
}
interface CommanderStatic extends Command {
Command: typeof local.Command;
Option: typeof local.Option;
CommandOptions: CommandOptions;
ParseOptionsResult: ParseOptionsResult;
}
}
declare const commander: commander.CommanderStatic;
export = commander;

154
frontend/node_modules/terser/package.json generated vendored Normal file
View File

@@ -0,0 +1,154 @@
{
"name": "terser",
"description": "JavaScript parser, mangler/compressor and beautifier toolkit for ES6+",
"homepage": "https://terser.org",
"author": "Mihai Bazon <mihai.bazon@gmail.com> (http://lisperator.net/)",
"license": "BSD-2-Clause",
"version": "5.43.1",
"engines": {
"node": ">=10"
},
"maintainers": [
"Fábio Santos <fabiosantosart@gmail.com>"
],
"repository": "https://github.com/terser/terser",
"main": "dist/bundle.min.js",
"type": "module",
"module": "./main.js",
"exports": {
".": [
{
"types": "./tools/terser.d.ts",
"import": "./main.js",
"require": "./dist/bundle.min.js"
},
"./dist/bundle.min.js"
],
"./package": "./package.json",
"./package.json": "./package.json",
"./bin/terser": "./bin/terser"
},
"types": "tools/terser.d.ts",
"bin": {
"terser": "bin/terser"
},
"files": [
"bin",
"dist",
"lib",
"tools",
"LICENSE",
"README.md",
"CHANGELOG.md",
"PATRONS.md",
"main.js"
],
"dependencies": {
"@jridgewell/source-map": "^0.3.3",
"acorn": "^8.14.0",
"commander": "^2.20.0",
"source-map-support": "~0.5.20"
},
"devDependencies": {
"@ls-lint/ls-lint": "^1.11.2",
"astring": "^1.8.5",
"eslint": "^7.32.0",
"eslump": "^3.0.0",
"esm": "^3.2.25",
"mocha": "^9.2.0",
"pre-commit": "^1.2.2",
"rollup": "^2.79.2",
"semver": "^7.5.1",
"source-map": "~0.8.0-beta.0"
},
"scripts": {
"test": "node test/compress.js && mocha test/mocha",
"test:compress": "node test/compress.js",
"test:mocha": "mocha test/mocha",
"lint": "eslint lib",
"lint-fix": "eslint --fix lib",
"ls-lint": "ls-lint",
"build": "rollup --config --silent",
"prepare": "npm run build",
"postversion": "echo 'Remember to update the changelog!'"
},
"keywords": [
"uglify",
"terser",
"uglify-es",
"uglify-js",
"minify",
"minifier",
"javascript",
"ecmascript",
"es5",
"es6",
"es7",
"es8",
"es2015",
"es2016",
"es2017",
"async",
"await"
],
"eslintConfig": {
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2020
},
"env": {
"node": true,
"browser": true,
"es2020": true
},
"globals": {
"describe": false,
"it": false,
"require": false,
"before": false,
"after": false,
"global": false,
"process": false
},
"rules": {
"brace-style": [
"error",
"1tbs",
{
"allowSingleLine": true
}
],
"quotes": [
"error",
"double",
"avoid-escape"
],
"no-debugger": "error",
"no-undef": "error",
"no-unused-vars": [
"error",
{
"varsIgnorePattern": "^_",
"argsIgnorePattern": "^_"
}
],
"no-tabs": "error",
"semi": [
"error",
"always"
],
"no-extra-semi": "error",
"no-irregular-whitespace": "error",
"space-before-blocks": [
"error",
"always"
]
}
},
"pre-commit": [
"build",
"lint-fix",
"ls-lint",
"test"
]
}

9026
frontend/node_modules/terser/tools/domprops.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

7
frontend/node_modules/terser/tools/exit.cjs generated vendored Normal file
View File

@@ -0,0 +1,7 @@
// workaround for tty output truncation upon process.exit()
// https://github.com/nodejs/node/issues/6456
[process.stdout, process.stderr].forEach((s) => {
s && s.isTTY && s._handle && s._handle.setBlocking &&
s._handle.setBlocking(true)
});

68
frontend/node_modules/terser/tools/props.html generated vendored Normal file
View File

@@ -0,0 +1,68 @@
<html>
<head>
</head>
<body>
<script>(function(){
var props = {};
function addObject(obj) {
if (obj == null) return;
try {
Object.getOwnPropertyNames(obj).forEach(add);
} catch(ex) {}
if (obj.prototype) {
Object.getOwnPropertyNames(obj.prototype).forEach(add);
}
if (typeof obj == "function") {
try {
Object.getOwnPropertyNames(new obj).forEach(add);
} catch(ex) {}
}
}
function add(name) {
if (/^[a-z_$][a-z0-9_$]*$/i.test(name)) {
props[name] = true;
}
}
Object.getOwnPropertyNames(window).forEach(function(thing){
addObject(window[thing]);
});
try {
addObject(new Event("click"));
addObject(new Event("contextmenu"));
addObject(new Event("mouseup"));
addObject(new Event("mousedown"));
addObject(new Event("keydown"));
addObject(new Event("keypress"));
addObject(new Event("keyup"));
addObject(new Event("input"));
addObject(new Event("touchstart"));
addObject(new Event("touchmove"));
addObject(new Event("touchend"));
addObject(new Event("touchcancel"));
addObject(new Event("pointerdown"));
addObject(new Event("pointermove"));
addObject(new Event("pointerup"));
addObject(new Event("pointercancel"));
addObject(new Event("pointerenter"));
addObject(new Event("pointerleave"));
} catch(ex) {}
var ta = document.createElement("textarea");
ta.style.width = "100%";
ta.style.height = "20em";
ta.style.boxSizing = "border-box";
ta.value = 'export var domprops = ' + JSON.stringify(Object.keys(props).sort(cmp), null, 4);
document.body.appendChild(ta);
function cmp(a, b) {
a = a.toLowerCase();
b = b.toLowerCase();
return a < b ? -1 : a > b ? 1 : 0;
}
})();</script>
</body>
</html>

217
frontend/node_modules/terser/tools/terser.d.ts generated vendored Normal file
View File

@@ -0,0 +1,217 @@
/// <reference lib="es2015" />
import { SectionedSourceMapInput, EncodedSourceMap, DecodedSourceMap } from '@jridgewell/source-map';
export type ECMA = 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020;
export type ConsoleProperty = keyof typeof console;
type DropConsoleOption = boolean | ConsoleProperty[];
export interface ParseOptions {
bare_returns?: boolean;
/** @deprecated legacy option. Currently, all supported EcmaScript is valid to parse. */
ecma?: ECMA;
html5_comments?: boolean;
shebang?: boolean;
}
export interface CompressOptions {
arguments?: boolean;
arrows?: boolean;
booleans_as_integers?: boolean;
booleans?: boolean;
collapse_vars?: boolean;
comparisons?: boolean;
computed_props?: boolean;
conditionals?: boolean;
dead_code?: boolean;
defaults?: boolean;
directives?: boolean;
drop_console?: DropConsoleOption;
drop_debugger?: boolean;
ecma?: ECMA;
evaluate?: boolean;
expression?: boolean;
global_defs?: object;
hoist_funs?: boolean;
hoist_props?: boolean;
hoist_vars?: boolean;
ie8?: boolean;
if_return?: boolean;
inline?: boolean | InlineFunctions;
join_vars?: boolean;
keep_classnames?: boolean | RegExp;
keep_fargs?: boolean;
keep_fnames?: boolean | RegExp;
keep_infinity?: boolean;
lhs_constants?: boolean;
loops?: boolean;
module?: boolean;
negate_iife?: boolean;
passes?: number;
properties?: boolean;
pure_funcs?: string[];
pure_new?: boolean;
pure_getters?: boolean | 'strict';
reduce_funcs?: boolean;
reduce_vars?: boolean;
sequences?: boolean | number;
side_effects?: boolean;
switches?: boolean;
toplevel?: boolean;
top_retain?: null | string | string[] | RegExp;
typeofs?: boolean;
unsafe_arrows?: boolean;
unsafe?: boolean;
unsafe_comps?: boolean;
unsafe_Function?: boolean;
unsafe_math?: boolean;
unsafe_symbols?: boolean;
unsafe_methods?: boolean;
unsafe_proto?: boolean;
unsafe_regexp?: boolean;
unsafe_undefined?: boolean;
unused?: boolean;
}
export enum InlineFunctions {
Disabled = 0,
SimpleFunctions = 1,
WithArguments = 2,
WithArgumentsAndVariables = 3
}
export interface MangleOptions {
eval?: boolean;
keep_classnames?: boolean | RegExp;
keep_fnames?: boolean | RegExp;
module?: boolean;
nth_identifier?: SimpleIdentifierMangler | WeightedIdentifierMangler;
properties?: boolean | ManglePropertiesOptions;
reserved?: string[];
safari10?: boolean;
toplevel?: boolean;
}
/**
* An identifier mangler for which the output is invariant with respect to the source code.
*/
export interface SimpleIdentifierMangler {
/**
* Obtains the nth most favored (usually shortest) identifier to rename a variable to.
* The mangler will increment n and retry until the return value is not in use in scope, and is not a reserved word.
* This function is expected to be stable; Evaluating get(n) === get(n) should always return true.
* @param n The ordinal of the identifier.
*/
get(n: number): string;
}
/**
* An identifier mangler that leverages character frequency analysis to determine identifier precedence.
*/
export interface WeightedIdentifierMangler extends SimpleIdentifierMangler {
/**
* Modifies the internal weighting of the input characters by the specified delta.
* Will be invoked on the entire printed AST, and then deduct mangleable identifiers.
* @param chars The characters to modify the weighting of.
* @param delta The numeric weight to add to the characters.
*/
consider(chars: string, delta: number): number;
/**
* Resets character weights.
*/
reset(): void;
/**
* Sorts identifiers by character frequency, in preparation for calls to get(n).
*/
sort(): void;
}
export interface ManglePropertiesOptions {
builtins?: boolean;
debug?: boolean;
keep_quoted?: boolean | 'strict';
nth_identifier?: SimpleIdentifierMangler | WeightedIdentifierMangler;
regex?: RegExp | string;
reserved?: string[];
}
export interface FormatOptions {
ascii_only?: boolean;
/** @deprecated Not implemented anymore */
beautify?: boolean;
braces?: boolean;
comments?: boolean | 'all' | 'some' | RegExp | ( (node: any, comment: {
value: string,
type: 'comment1' | 'comment2' | 'comment3' | 'comment4',
pos: number,
line: number,
col: number,
}) => boolean );
ecma?: ECMA;
ie8?: boolean;
keep_numbers?: boolean;
indent_level?: number;
indent_start?: number;
inline_script?: boolean;
keep_quoted_props?: boolean;
max_line_len?: number | false;
preamble?: string;
preserve_annotations?: boolean;
quote_keys?: boolean;
quote_style?: OutputQuoteStyle;
safari10?: boolean;
semicolons?: boolean;
shebang?: boolean;
shorthand?: boolean;
source_map?: SourceMapOptions;
webkit?: boolean;
width?: number;
wrap_iife?: boolean;
wrap_func_args?: boolean;
}
export enum OutputQuoteStyle {
PreferDouble = 0,
AlwaysSingle = 1,
AlwaysDouble = 2,
AlwaysOriginal = 3
}
export interface MinifyOptions {
compress?: boolean | CompressOptions;
ecma?: ECMA;
enclose?: boolean | string;
ie8?: boolean;
keep_classnames?: boolean | RegExp;
keep_fnames?: boolean | RegExp;
mangle?: boolean | MangleOptions;
module?: boolean;
nameCache?: object;
format?: FormatOptions;
/** @deprecated */
output?: FormatOptions;
parse?: ParseOptions;
safari10?: boolean;
sourceMap?: boolean | SourceMapOptions;
toplevel?: boolean;
}
export interface MinifyOutput {
code?: string;
map?: EncodedSourceMap | string;
decoded_map?: DecodedSourceMap | null;
}
export interface SourceMapOptions {
/** Source map object, 'inline' or source map file content */
content?: SectionedSourceMapInput | string;
includeSources?: boolean;
filename?: string;
root?: string;
asObject?: boolean;
url?: string | 'inline';
}
export function minify(files: string | string[] | { [file: string]: string }, options?: MinifyOptions): Promise<MinifyOutput>;
export function minify_sync(files: string | string[] | { [file: string]: string }, options?: MinifyOptions): MinifyOutput;