@markw65/monkeyc-optimizer 1.1.63 → 1.1.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +5 -4
- package/build/api.cjs +35 -35
- package/build/{chunk-SG7ODKRM.cjs → chunk-67LU4GPQ.cjs} +54 -49
- package/build/{chunk-Y2ZRISYL.cjs → chunk-MDTDXRQB.cjs} +634 -310
- package/build/optimizer.cjs +20 -18
- package/build/sdk-util.cjs +15 -15
- package/build/src/ast.d.ts +1 -13
- package/build/src/build-config.d.ts +83 -0
- package/build/src/optimizer-types.d.ts +2 -49
- package/build/src/optimizer.d.ts +2 -1
- package/build/util.cjs +26 -26
- package/build/worker-thread.cjs +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the "monkeyc-optimizer" package will be documented in this file.
|
|
4
4
|
|
|
5
|
+
### 1.1.65
|
|
6
|
+
|
|
7
|
+
- Fix lookup scopes for tuples and object literals (fixes #39)
|
|
8
|
+
- Fix a race creating the output directory
|
|
9
|
+
- Don't put system personality files in barrel namespace (partial fix for #40)
|
|
10
|
+
- Fix 'illegal argument' error with multi-line personality attributes (partial fix for #40)
|
|
11
|
+
- Fix filtering of source files in compiled barrels in analysis mode (fixes #41)
|
|
12
|
+
- Fix lookup of Barrel qualified names in resource references (fixes #43)
|
|
13
|
+
|
|
14
|
+
### 1.1.64
|
|
15
|
+
|
|
16
|
+
- Pull all relevent config options from any found settings files
|
|
17
|
+
- Look for a .code-workspace file, starting from the project folder and working upwards. Pull settings from it if found.
|
|
18
|
+
- Update the example code in the README to fix some nits.
|
|
19
|
+
|
|
5
20
|
### 1.1.63
|
|
6
21
|
|
|
7
22
|
- Fixes #31 again, after the fix for #35 broke it
|
package/README.md
CHANGED
|
@@ -16,11 +16,11 @@ See [Change Log](CHANGELOG.md)
|
|
|
16
16
|
|
|
17
17
|
## API
|
|
18
18
|
|
|
19
|
-
First you will need to [install nodejs/npm](https://nodejs.org/en/download).
|
|
19
|
+
First you will need to [install nodejs/npm](https://nodejs.org/en/download). Note that you need node 16.17.1 or later, preferably 18.20.3 or later
|
|
20
20
|
|
|
21
21
|
Then you can install the package. From the directory where you want to use it:
|
|
22
22
|
|
|
23
|
-
```
|
|
23
|
+
```sh
|
|
24
24
|
npm install -D @markw65/monkeyc-optimizer
|
|
25
25
|
```
|
|
26
26
|
|
|
@@ -31,7 +31,8 @@ import { buildOptimizedProject, getConfig } from "@markw65/monkeyc-optimizer";
|
|
|
31
31
|
import { optimizeProgram } from "@markw65/monkeyc-optimizer/sdk-util.js";
|
|
32
32
|
import * as path from "node:path";
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const cwd = process.cwd();
|
|
35
|
+
const jungleFiles = path.resolve(cwd, process.argv[2]);
|
|
35
36
|
const workspace = path.dirname(jungleFiles);
|
|
36
37
|
|
|
37
38
|
getConfig({
|
|
@@ -48,7 +49,7 @@ getConfig({
|
|
|
48
49
|
// Defaults to bin. Relative paths are relative to workspace
|
|
49
50
|
buildDir: "bin",
|
|
50
51
|
// Where to put the files generated by the source-to-source optimizer
|
|
51
|
-
// Defaults to
|
|
52
|
+
// Defaults to `${buildDir}/optimized`. Relative paths are relative to workspace
|
|
52
53
|
outputPath: "bin/optimized",
|
|
53
54
|
// Semi-colon separated list of jungle files
|
|
54
55
|
jungleFiles,
|
package/build/api.cjs
CHANGED
|
@@ -18,47 +18,47 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var api_exports = {};
|
|
20
20
|
__export(api_exports, {
|
|
21
|
-
checkCompilerVersion: () =>
|
|
22
|
-
collectNamespaces: () =>
|
|
23
|
-
createDocumentationMap: () =>
|
|
24
|
-
diagnostic: () =>
|
|
25
|
-
diagnosticHelper: () =>
|
|
26
|
-
findNamesInScope: () =>
|
|
27
|
-
findUsingForNode: () =>
|
|
28
|
-
formatAst: () =>
|
|
29
|
-
formatAstLongLines: () =>
|
|
30
|
-
formatScopedName: () =>
|
|
31
|
-
getApiFunctionInfo: () =>
|
|
32
|
-
getApiMapping: () =>
|
|
33
|
-
getSuperClasses: () =>
|
|
21
|
+
checkCompilerVersion: () => import_chunk_MDTDXRQB.checkCompilerVersion,
|
|
22
|
+
collectNamespaces: () => import_chunk_MDTDXRQB.collectNamespaces,
|
|
23
|
+
createDocumentationMap: () => import_chunk_MDTDXRQB.createDocumentationMap,
|
|
24
|
+
diagnostic: () => import_chunk_MDTDXRQB.diagnostic,
|
|
25
|
+
diagnosticHelper: () => import_chunk_MDTDXRQB.diagnosticHelper,
|
|
26
|
+
findNamesInScope: () => import_chunk_MDTDXRQB.findNamesInScope,
|
|
27
|
+
findUsingForNode: () => import_chunk_MDTDXRQB.findUsingForNode,
|
|
28
|
+
formatAst: () => import_chunk_MDTDXRQB.formatAst,
|
|
29
|
+
formatAstLongLines: () => import_chunk_MDTDXRQB.formatAstLongLines,
|
|
30
|
+
formatScopedName: () => import_chunk_MDTDXRQB.formatScopedName,
|
|
31
|
+
getApiFunctionInfo: () => import_chunk_MDTDXRQB.getApiFunctionInfo,
|
|
32
|
+
getApiMapping: () => import_chunk_MDTDXRQB.getApiMapping,
|
|
33
|
+
getSuperClasses: () => import_chunk_MDTDXRQB.getSuperClasses,
|
|
34
34
|
hasProperty: () => import_chunk_MBTLUWXR.hasProperty,
|
|
35
|
-
isClassVariable: () =>
|
|
36
|
-
isLocal: () =>
|
|
37
|
-
isLookupCandidate: () =>
|
|
38
|
-
isStateNode: () =>
|
|
39
|
-
lookupByFullName: () =>
|
|
40
|
-
lookupNext: () =>
|
|
41
|
-
lookupResultContains: () =>
|
|
42
|
-
lookupWithType: () =>
|
|
43
|
-
makeToyboxLink: () =>
|
|
44
|
-
mapVarDeclsByType: () =>
|
|
45
|
-
markInvokeClassMethod: () =>
|
|
46
|
-
parseSdkVersion: () =>
|
|
47
|
-
resolveDiagnostics: () =>
|
|
48
|
-
resolveDiagnosticsMap: () =>
|
|
49
|
-
sameLookupResult: () =>
|
|
35
|
+
isClassVariable: () => import_chunk_MDTDXRQB.isClassVariable,
|
|
36
|
+
isLocal: () => import_chunk_MDTDXRQB.isLocal,
|
|
37
|
+
isLookupCandidate: () => import_chunk_MDTDXRQB.isLookupCandidate,
|
|
38
|
+
isStateNode: () => import_chunk_MDTDXRQB.isStateNode,
|
|
39
|
+
lookupByFullName: () => import_chunk_MDTDXRQB.lookupByFullName,
|
|
40
|
+
lookupNext: () => import_chunk_MDTDXRQB.lookupNext,
|
|
41
|
+
lookupResultContains: () => import_chunk_MDTDXRQB.lookupResultContains,
|
|
42
|
+
lookupWithType: () => import_chunk_MDTDXRQB.lookupWithType,
|
|
43
|
+
makeToyboxLink: () => import_chunk_MDTDXRQB.makeToyboxLink,
|
|
44
|
+
mapVarDeclsByType: () => import_chunk_MDTDXRQB.mapVarDeclsByType,
|
|
45
|
+
markInvokeClassMethod: () => import_chunk_MDTDXRQB.markInvokeClassMethod,
|
|
46
|
+
parseSdkVersion: () => import_chunk_MDTDXRQB.parseSdkVersion,
|
|
47
|
+
resolveDiagnostics: () => import_chunk_MDTDXRQB.resolveDiagnostics,
|
|
48
|
+
resolveDiagnosticsMap: () => import_chunk_MDTDXRQB.resolveDiagnosticsMap,
|
|
49
|
+
sameLookupResult: () => import_chunk_MDTDXRQB.sameLookupResult,
|
|
50
50
|
traverseAst: () => import_chunk_MBTLUWXR.traverseAst,
|
|
51
|
-
variableDeclarationName: () =>
|
|
52
|
-
visitReferences: () =>
|
|
53
|
-
visit_resources: () =>
|
|
54
|
-
visitorNode: () =>
|
|
51
|
+
variableDeclarationName: () => import_chunk_MDTDXRQB.variableDeclarationName,
|
|
52
|
+
visitReferences: () => import_chunk_MDTDXRQB.visitReferences,
|
|
53
|
+
visit_resources: () => import_chunk_MDTDXRQB.visit_resources,
|
|
54
|
+
visitorNode: () => import_chunk_MDTDXRQB.visitorNode
|
|
55
55
|
});
|
|
56
56
|
module.exports = __toCommonJS(api_exports);
|
|
57
|
-
var
|
|
58
|
-
var
|
|
57
|
+
var import_chunk_MDTDXRQB = require("./chunk-MDTDXRQB.cjs");
|
|
58
|
+
var import_chunk_67LU4GPQ = require("./chunk-67LU4GPQ.cjs");
|
|
59
59
|
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
60
60
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
61
|
-
(0,
|
|
61
|
+
(0, import_chunk_MDTDXRQB.init_api)();
|
|
62
62
|
// Annotate the CommonJS export names for ESM import in node:
|
|
63
63
|
0 && (module.exports = {
|
|
64
64
|
checkCompilerVersion,
|
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_67LU4GPQ_exports = {};
|
|
30
|
+
__export(chunk_67LU4GPQ_exports, {
|
|
31
31
|
AwaitedError: () => AwaitedError,
|
|
32
32
|
GenericQueue: () => GenericQueue,
|
|
33
33
|
bumpLogging: () => bumpLogging,
|
|
@@ -55,7 +55,7 @@ __export(chunk_SG7ODKRM_exports, {
|
|
|
55
55
|
spawnByLine: () => spawnByLine,
|
|
56
56
|
wouldLog: () => wouldLog
|
|
57
57
|
});
|
|
58
|
-
module.exports = __toCommonJS(
|
|
58
|
+
module.exports = __toCommonJS(chunk_67LU4GPQ_exports);
|
|
59
59
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
60
60
|
var child_process = __toESM(require("child_process"));
|
|
61
61
|
var fsc = __toESM(require("fs"));
|
|
@@ -346,7 +346,7 @@ var require_utils = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
346
346
|
return (Number(max) - Number(min)) / Number(step) >= limit;
|
|
347
347
|
};
|
|
348
348
|
exports.escapeNode = (block, n = 0, type) => {
|
|
349
|
-
|
|
349
|
+
const node = block.nodes[n];
|
|
350
350
|
if (!node)
|
|
351
351
|
return;
|
|
352
352
|
if (type && node.type === type || node.type === "open" || node.type === "close") {
|
|
@@ -397,8 +397,14 @@ var require_utils = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
397
397
|
const result = [];
|
|
398
398
|
const flat = (arr) => {
|
|
399
399
|
for (let i = 0; i < arr.length; i++) {
|
|
400
|
-
|
|
401
|
-
Array.isArray(ele)
|
|
400
|
+
const ele = arr[i];
|
|
401
|
+
if (Array.isArray(ele)) {
|
|
402
|
+
flat(ele);
|
|
403
|
+
continue;
|
|
404
|
+
}
|
|
405
|
+
if (ele !== void 0) {
|
|
406
|
+
result.push(ele);
|
|
407
|
+
}
|
|
402
408
|
}
|
|
403
409
|
return result;
|
|
404
410
|
};
|
|
@@ -412,9 +418,9 @@ var require_stringify = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
412
418
|
"use strict";
|
|
413
419
|
var utils = require_utils();
|
|
414
420
|
module2.exports = (ast, options = {}) => {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
421
|
+
const stringify = (node, parent = {}) => {
|
|
422
|
+
const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
|
|
423
|
+
const invalidNode = node.invalid === true && options.escapeInvalid === true;
|
|
418
424
|
let output = "";
|
|
419
425
|
if (node.value) {
|
|
420
426
|
if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
|
|
@@ -426,7 +432,7 @@ var require_stringify = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
426
432
|
return node.value;
|
|
427
433
|
}
|
|
428
434
|
if (node.nodes) {
|
|
429
|
-
for (
|
|
435
|
+
for (const child of node.nodes) {
|
|
430
436
|
output += stringify(child);
|
|
431
437
|
}
|
|
432
438
|
}
|
|
@@ -712,7 +718,7 @@ var require_fill_range = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
712
718
|
input = "0" + input;
|
|
713
719
|
return negative ? "-" + input : input;
|
|
714
720
|
};
|
|
715
|
-
var toSequence = (parts, options) => {
|
|
721
|
+
var toSequence = (parts, options, maxLen) => {
|
|
716
722
|
parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
717
723
|
parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
718
724
|
let prefix = options.capture ? "" : "?:";
|
|
@@ -720,10 +726,10 @@ var require_fill_range = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
720
726
|
let negatives = "";
|
|
721
727
|
let result;
|
|
722
728
|
if (parts.positives.length) {
|
|
723
|
-
positives = parts.positives.join("|");
|
|
729
|
+
positives = parts.positives.map((v) => toMaxLen(String(v), maxLen)).join("|");
|
|
724
730
|
}
|
|
725
731
|
if (parts.negatives.length) {
|
|
726
|
-
negatives = `-(${prefix}${parts.negatives.join("|")})`;
|
|
732
|
+
negatives = `-(${prefix}${parts.negatives.map((v) => toMaxLen(String(v), maxLen)).join("|")})`;
|
|
727
733
|
}
|
|
728
734
|
if (positives && negatives) {
|
|
729
735
|
result = `${positives}|${negatives}`;
|
|
@@ -805,7 +811,7 @@ var require_fill_range = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
805
811
|
index++;
|
|
806
812
|
}
|
|
807
813
|
if (options.toRegex === true) {
|
|
808
|
-
return step > 1 ? toSequence(parts, options) : toRegex(range, null, { wrap: false, ...options });
|
|
814
|
+
return step > 1 ? toSequence(parts, options, maxLen) : toRegex(range, null, { wrap: false, ...options });
|
|
809
815
|
}
|
|
810
816
|
return range;
|
|
811
817
|
};
|
|
@@ -870,16 +876,17 @@ var require_compile = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
870
876
|
var fill = require_fill_range();
|
|
871
877
|
var utils = require_utils();
|
|
872
878
|
var compile = (ast, options = {}) => {
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
879
|
+
const walk = (node, parent = {}) => {
|
|
880
|
+
const invalidBlock = utils.isInvalidBrace(parent);
|
|
881
|
+
const invalidNode = node.invalid === true && options.escapeInvalid === true;
|
|
882
|
+
const invalid = invalidBlock === true || invalidNode === true;
|
|
883
|
+
const prefix = options.escapeInvalid === true ? "\\" : "";
|
|
878
884
|
let output = "";
|
|
879
885
|
if (node.isOpen === true) {
|
|
880
886
|
return prefix + node.value;
|
|
881
887
|
}
|
|
882
888
|
if (node.isClose === true) {
|
|
889
|
+
console.log("node.isClose", prefix, node.value);
|
|
883
890
|
return prefix + node.value;
|
|
884
891
|
}
|
|
885
892
|
if (node.type === "open") {
|
|
@@ -895,14 +902,14 @@ var require_compile = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
895
902
|
return node.value;
|
|
896
903
|
}
|
|
897
904
|
if (node.nodes && node.ranges > 0) {
|
|
898
|
-
|
|
899
|
-
|
|
905
|
+
const args = utils.reduce(node.nodes);
|
|
906
|
+
const range = fill(...args, { ...options, wrap: false, toRegex: true, strictZeros: true });
|
|
900
907
|
if (range.length !== 0) {
|
|
901
908
|
return args.length > 1 && range.length > 1 ? `(${range})` : range;
|
|
902
909
|
}
|
|
903
910
|
}
|
|
904
911
|
if (node.nodes) {
|
|
905
|
-
for (
|
|
912
|
+
for (const child of node.nodes) {
|
|
906
913
|
output += walk(child, node);
|
|
907
914
|
}
|
|
908
915
|
}
|
|
@@ -920,7 +927,7 @@ var require_expand = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
920
927
|
var stringify = require_stringify();
|
|
921
928
|
var utils = require_utils();
|
|
922
929
|
var append = (queue = "", stash = "", enclose = false) => {
|
|
923
|
-
|
|
930
|
+
const result = [];
|
|
924
931
|
queue = [].concat(queue);
|
|
925
932
|
stash = [].concat(stash);
|
|
926
933
|
if (!stash.length)
|
|
@@ -928,9 +935,9 @@ var require_expand = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
928
935
|
if (!queue.length) {
|
|
929
936
|
return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash;
|
|
930
937
|
}
|
|
931
|
-
for (
|
|
938
|
+
for (const item of queue) {
|
|
932
939
|
if (Array.isArray(item)) {
|
|
933
|
-
for (
|
|
940
|
+
for (const value of item) {
|
|
934
941
|
result.push(append(value, stash, enclose));
|
|
935
942
|
}
|
|
936
943
|
} else {
|
|
@@ -944,8 +951,8 @@ var require_expand = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
944
951
|
return utils.flatten(result);
|
|
945
952
|
};
|
|
946
953
|
var expand = (ast, options = {}) => {
|
|
947
|
-
|
|
948
|
-
|
|
954
|
+
const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
955
|
+
const walk = (node, parent = {}) => {
|
|
949
956
|
node.queue = [];
|
|
950
957
|
let p = parent;
|
|
951
958
|
let q = parent.queue;
|
|
@@ -962,7 +969,7 @@ var require_expand = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
962
969
|
return;
|
|
963
970
|
}
|
|
964
971
|
if (node.nodes && node.ranges > 0) {
|
|
965
|
-
|
|
972
|
+
const args = utils.reduce(node.nodes);
|
|
966
973
|
if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
|
|
967
974
|
throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
|
|
968
975
|
}
|
|
@@ -974,7 +981,7 @@ var require_expand = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
974
981
|
node.nodes = [];
|
|
975
982
|
return;
|
|
976
983
|
}
|
|
977
|
-
|
|
984
|
+
const enclose = utils.encloseBrace(node);
|
|
978
985
|
let queue = node.queue;
|
|
979
986
|
let block = node;
|
|
980
987
|
while (block.type !== "brace" && block.type !== "root" && block.parent) {
|
|
@@ -982,7 +989,7 @@ var require_expand = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
982
989
|
queue = block.queue;
|
|
983
990
|
}
|
|
984
991
|
for (let i = 0; i < node.nodes.length; i++) {
|
|
985
|
-
|
|
992
|
+
const child = node.nodes[i];
|
|
986
993
|
if (child.type === "comma" && node.type === "brace") {
|
|
987
994
|
if (i === 1)
|
|
988
995
|
queue.push("");
|
|
@@ -1012,7 +1019,7 @@ var require_constants = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
1012
1019
|
"node_modules/braces/lib/constants.js"(exports, module2) {
|
|
1013
1020
|
"use strict";
|
|
1014
1021
|
module2.exports = {
|
|
1015
|
-
MAX_LENGTH:
|
|
1022
|
+
MAX_LENGTH: 1e4,
|
|
1016
1023
|
// Digits
|
|
1017
1024
|
CHAR_0: "0",
|
|
1018
1025
|
/* 0 */
|
|
@@ -1144,21 +1151,20 @@ var require_parse = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
1144
1151
|
if (typeof input !== "string") {
|
|
1145
1152
|
throw new TypeError("Expected a string");
|
|
1146
1153
|
}
|
|
1147
|
-
|
|
1148
|
-
|
|
1154
|
+
const opts = options || {};
|
|
1155
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
1149
1156
|
if (input.length > max) {
|
|
1150
1157
|
throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
|
|
1151
1158
|
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1159
|
+
const ast = { type: "root", input, nodes: [] };
|
|
1160
|
+
const stack = [ast];
|
|
1154
1161
|
let block = ast;
|
|
1155
1162
|
let prev = ast;
|
|
1156
1163
|
let brackets = 0;
|
|
1157
|
-
|
|
1164
|
+
const length = input.length;
|
|
1158
1165
|
let index = 0;
|
|
1159
1166
|
let depth = 0;
|
|
1160
1167
|
let value;
|
|
1161
|
-
let memo = {};
|
|
1162
1168
|
const advance = () => input[index++];
|
|
1163
1169
|
const push = (node) => {
|
|
1164
1170
|
if (node.type === "text" && prev.type === "dot") {
|
|
@@ -1191,7 +1197,6 @@ var require_parse = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
1191
1197
|
}
|
|
1192
1198
|
if (value === CHAR_LEFT_SQUARE_BRACKET) {
|
|
1193
1199
|
brackets++;
|
|
1194
|
-
let closed = true;
|
|
1195
1200
|
let next;
|
|
1196
1201
|
while (index < length && (next = advance())) {
|
|
1197
1202
|
value += next;
|
|
@@ -1230,7 +1235,7 @@ var require_parse = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
1230
1235
|
continue;
|
|
1231
1236
|
}
|
|
1232
1237
|
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
1233
|
-
|
|
1238
|
+
const open2 = value;
|
|
1234
1239
|
let next;
|
|
1235
1240
|
if (options.keepQuotes !== true) {
|
|
1236
1241
|
value = "";
|
|
@@ -1252,8 +1257,8 @@ var require_parse = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
1252
1257
|
}
|
|
1253
1258
|
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
1254
1259
|
depth++;
|
|
1255
|
-
|
|
1256
|
-
|
|
1260
|
+
const dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
|
|
1261
|
+
const brace = {
|
|
1257
1262
|
type: "brace",
|
|
1258
1263
|
open: true,
|
|
1259
1264
|
close: false,
|
|
@@ -1273,7 +1278,7 @@ var require_parse = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
1273
1278
|
push({ type: "text", value });
|
|
1274
1279
|
continue;
|
|
1275
1280
|
}
|
|
1276
|
-
|
|
1281
|
+
const type = "close";
|
|
1277
1282
|
block = stack.pop();
|
|
1278
1283
|
block.close = true;
|
|
1279
1284
|
push({ type, value });
|
|
@@ -1284,7 +1289,7 @@ var require_parse = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
1284
1289
|
if (value === CHAR_COMMA && depth > 0) {
|
|
1285
1290
|
if (block.ranges > 0) {
|
|
1286
1291
|
block.ranges = 0;
|
|
1287
|
-
|
|
1292
|
+
const open2 = block.nodes.shift();
|
|
1288
1293
|
block.nodes = [open2, { type: "text", value: stringify(block) }];
|
|
1289
1294
|
}
|
|
1290
1295
|
push({ type: "comma", value });
|
|
@@ -1292,7 +1297,7 @@ var require_parse = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
1292
1297
|
continue;
|
|
1293
1298
|
}
|
|
1294
1299
|
if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
|
|
1295
|
-
|
|
1300
|
+
const siblings = block.nodes;
|
|
1296
1301
|
if (depth === 0 || siblings.length === 0) {
|
|
1297
1302
|
push({ type: "text", value });
|
|
1298
1303
|
continue;
|
|
@@ -1313,7 +1318,7 @@ var require_parse = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
1313
1318
|
}
|
|
1314
1319
|
if (prev.type === "range") {
|
|
1315
1320
|
siblings.pop();
|
|
1316
|
-
|
|
1321
|
+
const before = siblings[siblings.length - 1];
|
|
1317
1322
|
before.value += prev.value + value;
|
|
1318
1323
|
prev = before;
|
|
1319
1324
|
block.ranges--;
|
|
@@ -1338,8 +1343,8 @@ var require_parse = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
1338
1343
|
node.invalid = true;
|
|
1339
1344
|
}
|
|
1340
1345
|
});
|
|
1341
|
-
|
|
1342
|
-
|
|
1346
|
+
const parent = stack[stack.length - 1];
|
|
1347
|
+
const index2 = parent.nodes.indexOf(block);
|
|
1343
1348
|
parent.nodes.splice(index2, 1, ...block.nodes);
|
|
1344
1349
|
}
|
|
1345
1350
|
} while (stack.length > 0);
|
|
@@ -1359,8 +1364,8 @@ var require_braces = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
|
1359
1364
|
var braces = (input, options = {}) => {
|
|
1360
1365
|
let output = [];
|
|
1361
1366
|
if (Array.isArray(input)) {
|
|
1362
|
-
for (
|
|
1363
|
-
|
|
1367
|
+
for (const pattern of input) {
|
|
1368
|
+
const result = braces.create(pattern, options);
|
|
1364
1369
|
if (Array.isArray(result)) {
|
|
1365
1370
|
output.push(...result);
|
|
1366
1371
|
} else {
|