@danielx/civet 0.7.29 → 0.7.31
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 +10 -0
- package/README.md +2 -1
- package/dist/browser.js +360 -118
- package/dist/civet +1 -0
- package/dist/main.js +280 -105
- package/dist/main.mjs +280 -105
- package/package.json +2 -2
package/dist/browser.js
CHANGED
|
@@ -492,20 +492,22 @@ ${body}`;
|
|
|
492
492
|
}
|
|
493
493
|
});
|
|
494
494
|
|
|
495
|
-
// source/
|
|
496
|
-
var
|
|
497
|
-
__export(
|
|
495
|
+
// source/browser.civet
|
|
496
|
+
var browser_exports = {};
|
|
497
|
+
__export(browser_exports, {
|
|
498
498
|
ParseError: () => import_lib3.ParseError,
|
|
499
499
|
ParseErrors: () => ParseErrors,
|
|
500
500
|
SourceMap: () => SourceMap2,
|
|
501
|
+
autoRunScripts: () => autoRunScripts,
|
|
501
502
|
compile: () => compile,
|
|
502
|
-
default: () => main_default,
|
|
503
503
|
generate: () => generate_default,
|
|
504
504
|
isCompileError: () => isCompileError,
|
|
505
505
|
lib: () => lib_exports,
|
|
506
506
|
parse: () => parse,
|
|
507
507
|
parseProgram: () => parseProgram,
|
|
508
508
|
prune: () => prune,
|
|
509
|
+
runScript: () => runScript,
|
|
510
|
+
runScripts: () => runScripts,
|
|
509
511
|
sourcemap: () => sourcemap_exports
|
|
510
512
|
});
|
|
511
513
|
|
|
@@ -685,7 +687,7 @@ ${body}`;
|
|
|
685
687
|
"ForStatement",
|
|
686
688
|
"IfStatement",
|
|
687
689
|
"IterationStatement",
|
|
688
|
-
"
|
|
690
|
+
"LabelledStatement",
|
|
689
691
|
"ReturnStatement",
|
|
690
692
|
"SwitchStatement",
|
|
691
693
|
"ThrowStatement",
|
|
@@ -730,13 +732,16 @@ ${body}`;
|
|
|
730
732
|
return node.expressions.some((s) => isExit(s[1]));
|
|
731
733
|
}
|
|
732
734
|
case "IterationStatement": {
|
|
733
|
-
return node
|
|
735
|
+
return isLoopStatement(node) && gatherRecursiveWithinFunction(node.block, ($) => $.type === "BreakStatement").length === 0;
|
|
734
736
|
}
|
|
735
737
|
default: {
|
|
736
738
|
return false;
|
|
737
739
|
}
|
|
738
740
|
}
|
|
739
741
|
}
|
|
742
|
+
function isLoopStatement(node) {
|
|
743
|
+
return node.type === "IterationStatement" && node.condition?.type === "ParenthesizedExpression" && node.condition.expression?.type === "Literal" && node.condition.expression?.raw === "true";
|
|
744
|
+
}
|
|
740
745
|
function isComma(node) {
|
|
741
746
|
if (node?.token === ",") {
|
|
742
747
|
return node;
|
|
@@ -1102,7 +1107,7 @@ ${body}`;
|
|
|
1102
1107
|
}
|
|
1103
1108
|
return ["(", type, ")"];
|
|
1104
1109
|
}
|
|
1105
|
-
function wrapIIFE(expressions, asyncFlag) {
|
|
1110
|
+
function wrapIIFE(expressions, asyncFlag, generator) {
|
|
1106
1111
|
let prefix;
|
|
1107
1112
|
const async = [];
|
|
1108
1113
|
if (asyncFlag) {
|
|
@@ -1128,23 +1133,49 @@ ${body}`;
|
|
|
1128
1133
|
};
|
|
1129
1134
|
const signature = {
|
|
1130
1135
|
modifier: {
|
|
1131
|
-
async: !!async.length
|
|
1136
|
+
async: !!async.length,
|
|
1137
|
+
generator: !!generator
|
|
1132
1138
|
},
|
|
1133
1139
|
returnType: void 0
|
|
1134
1140
|
};
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1141
|
+
let fn;
|
|
1142
|
+
if (generator) {
|
|
1143
|
+
fn = makeNode({
|
|
1144
|
+
type: "FunctionExpression",
|
|
1145
|
+
signature,
|
|
1146
|
+
parameters,
|
|
1147
|
+
returnType: void 0,
|
|
1148
|
+
ts: false,
|
|
1149
|
+
async,
|
|
1150
|
+
block,
|
|
1151
|
+
generator,
|
|
1152
|
+
children: [async, "function", generator, parameters, block]
|
|
1153
|
+
});
|
|
1154
|
+
} else {
|
|
1155
|
+
fn = makeNode({
|
|
1156
|
+
type: "ArrowFunction",
|
|
1157
|
+
signature,
|
|
1158
|
+
parameters,
|
|
1159
|
+
returnType: void 0,
|
|
1160
|
+
ts: false,
|
|
1161
|
+
async,
|
|
1162
|
+
block,
|
|
1163
|
+
children: [async, parameters, "=>", block]
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
const children = [makeLeftHandSideExpression(fn), "()"];
|
|
1167
|
+
if (fn.type === "FunctionExpression") {
|
|
1168
|
+
if (gatherRecursiveWithinFunction(block, (a1) => typeof a1 === "object" && a1 != null && "token" in a1 && a1.token === "this").length) {
|
|
1169
|
+
children.splice(1, 0, ".bind(this)");
|
|
1170
|
+
}
|
|
1171
|
+
if (gatherRecursiveWithinFunction(block, (a2) => typeof a2 === "object" && a2 != null && "token" in a2 && a2.token === "arguments").length) {
|
|
1172
|
+
let ref2;
|
|
1173
|
+
children[children.length - 1] = (ref2 = parameters.children)[ref2.length - 1] = "(arguments)";
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1145
1176
|
const exp = makeNode({
|
|
1146
1177
|
type: "CallExpression",
|
|
1147
|
-
children
|
|
1178
|
+
children
|
|
1148
1179
|
});
|
|
1149
1180
|
if (prefix) {
|
|
1150
1181
|
return makeLeftHandSideExpression([prefix, exp]);
|
|
@@ -1765,7 +1796,7 @@ ${body}`;
|
|
|
1765
1796
|
({ type } = exp);
|
|
1766
1797
|
}
|
|
1767
1798
|
let ref4;
|
|
1768
|
-
switch (
|
|
1799
|
+
switch (type) {
|
|
1769
1800
|
case "BreakStatement":
|
|
1770
1801
|
case "ContinueStatement":
|
|
1771
1802
|
case "DebuggerStatement":
|
|
@@ -1986,6 +2017,58 @@ ${body}`;
|
|
|
1986
2017
|
return insertReturn(clause);
|
|
1987
2018
|
});
|
|
1988
2019
|
}
|
|
2020
|
+
function processBreakContinueWith(statement) {
|
|
2021
|
+
let changed = false;
|
|
2022
|
+
for (const control of gatherRecursiveWithinFunction(
|
|
2023
|
+
statement.block,
|
|
2024
|
+
($) => $.type === "BreakStatement" || $.type === "ContinueStatement"
|
|
2025
|
+
)) {
|
|
2026
|
+
let controlName2 = function() {
|
|
2027
|
+
switch (control.type) {
|
|
2028
|
+
case "BreakStatement": {
|
|
2029
|
+
return "break";
|
|
2030
|
+
}
|
|
2031
|
+
case "ContinueStatement": {
|
|
2032
|
+
return "continue";
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
};
|
|
2036
|
+
var controlName = controlName2;
|
|
2037
|
+
if (control.with) {
|
|
2038
|
+
if (control.label) {
|
|
2039
|
+
let m1;
|
|
2040
|
+
if (!(m1 = statement.parent, typeof m1 === "object" && m1 != null && "type" in m1 && m1.type === "LabelledStatement" && "label" in m1 && typeof m1.label === "object" && m1.label != null && "name" in m1.label && m1.label.name === control.label.name)) {
|
|
2041
|
+
continue;
|
|
2042
|
+
}
|
|
2043
|
+
} else {
|
|
2044
|
+
const { ancestor } = findAncestor(
|
|
2045
|
+
control,
|
|
2046
|
+
(s) => s === statement || s.type === "IterationStatement" || s.type === "ForStatement" || s.type === "SwitchStatement" && control.type === "BreakStatement"
|
|
2047
|
+
);
|
|
2048
|
+
if (!(ancestor === statement)) {
|
|
2049
|
+
continue;
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
control.children.unshift(
|
|
2053
|
+
control.type === "BreakStatement" ? (changed = true, [statement.resultsRef, " =", control.with, ";"]) : (
|
|
2054
|
+
// control.type is "ContinueStatement"
|
|
2055
|
+
[statement.resultsRef, ".push(", trimFirstSpace(control.with), ");"]
|
|
2056
|
+
)
|
|
2057
|
+
);
|
|
2058
|
+
updateParentPointers(control.with, control);
|
|
2059
|
+
const i = control.children.findIndex(($1) => $1?.type === "Error");
|
|
2060
|
+
if (i >= 0) {
|
|
2061
|
+
control.children.splice(i, 1);
|
|
2062
|
+
}
|
|
2063
|
+
const block = control.parent;
|
|
2064
|
+
if (!(block?.type === "BlockStatement")) {
|
|
2065
|
+
throw new Error(`Expected parent of ${controlName2()} to be BlockStatement`);
|
|
2066
|
+
}
|
|
2067
|
+
braceBlock(block);
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
return changed;
|
|
2071
|
+
}
|
|
1989
2072
|
function wrapIterationReturningResults(statement, outer, collect) {
|
|
1990
2073
|
if (statement.type === "DoStatement" || statement.type === "ComptimeStatement") {
|
|
1991
2074
|
if (collect) {
|
|
@@ -2001,14 +2084,37 @@ ${body}`;
|
|
|
2001
2084
|
"wrapIterationReturningResults should not be called twice on the same statement"
|
|
2002
2085
|
);
|
|
2003
2086
|
const resultsRef = statement.resultsRef = makeRef("results");
|
|
2087
|
+
let decl = "const";
|
|
2088
|
+
if (statement.type === "IterationStatement" || statement.type === "ForStatement") {
|
|
2089
|
+
if (processBreakContinueWith(statement)) {
|
|
2090
|
+
decl = "let";
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
const breakWithOnly = decl === "let" && isLoopStatement(statement) && gatherRecursive(
|
|
2094
|
+
statement.block,
|
|
2095
|
+
(s) => s.type === "BreakStatement" && !s.with,
|
|
2096
|
+
(s) => isFunction(s) || s.type === "IterationStatement"
|
|
2097
|
+
).length === 0;
|
|
2004
2098
|
const declaration = {
|
|
2005
2099
|
type: "Declaration",
|
|
2006
|
-
children: ["
|
|
2100
|
+
children: [decl, " ", resultsRef],
|
|
2101
|
+
decl,
|
|
2102
|
+
names: [],
|
|
2103
|
+
bindings: []
|
|
2007
2104
|
};
|
|
2105
|
+
if (decl === "const") {
|
|
2106
|
+
declaration.children.push("=[]");
|
|
2107
|
+
} else {
|
|
2108
|
+
if (!breakWithOnly) {
|
|
2109
|
+
declaration.children.push(";", resultsRef, "=[]");
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2008
2112
|
outer.children.unshift(["", declaration, ";"]);
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2113
|
+
if (!breakWithOnly) {
|
|
2114
|
+
assignResults(statement.block, (node) => {
|
|
2115
|
+
return [resultsRef, ".push(", node, ")"];
|
|
2116
|
+
});
|
|
2117
|
+
}
|
|
2012
2118
|
if (collect) {
|
|
2013
2119
|
statement.children.push(collect(resultsRef));
|
|
2014
2120
|
} else {
|
|
@@ -2074,8 +2180,8 @@ ${body}`;
|
|
|
2074
2180
|
}
|
|
2075
2181
|
if (hasYield(block) && !f.generator?.length) {
|
|
2076
2182
|
if (f.type === "ArrowFunction") {
|
|
2077
|
-
gatherRecursiveWithinFunction(block, ($) =>
|
|
2078
|
-
const i = y.children.findIndex(($
|
|
2183
|
+
gatherRecursiveWithinFunction(block, ($2) => $2.type === "YieldExpression").forEach((y) => {
|
|
2184
|
+
const i = y.children.findIndex(($3) => $3.type === "Yield");
|
|
2079
2185
|
return y.children.splice(i + 1, 0, {
|
|
2080
2186
|
type: "Error",
|
|
2081
2187
|
message: "Can't use yield inside of => arrow function"
|
|
@@ -2103,31 +2209,55 @@ ${body}`;
|
|
|
2103
2209
|
});
|
|
2104
2210
|
}
|
|
2105
2211
|
function expressionizeIteration(exp) {
|
|
2106
|
-
const { async, subtype, block, children, statement } = exp;
|
|
2212
|
+
const { async, generator, subtype, block, children, statement } = exp;
|
|
2107
2213
|
const i = children.indexOf(statement);
|
|
2108
2214
|
if (i < 0) {
|
|
2109
2215
|
throw new Error("Could not find iteration statement in iteration expression");
|
|
2110
2216
|
}
|
|
2111
2217
|
if (subtype === "DoStatement" || subtype === "ComptimeStatement") {
|
|
2112
|
-
children.splice(i, 1, wrapIIFE([["", statement, void 0]], async));
|
|
2218
|
+
children.splice(i, 1, wrapIIFE([["", statement, void 0]], async, generator));
|
|
2113
2219
|
updateParentPointers(exp);
|
|
2114
2220
|
return;
|
|
2115
2221
|
}
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
[
|
|
2129
|
-
|
|
2130
|
-
|
|
2222
|
+
if (generator) {
|
|
2223
|
+
assignResults(block, (node) => {
|
|
2224
|
+
return {
|
|
2225
|
+
type: "YieldExpression",
|
|
2226
|
+
expression: node,
|
|
2227
|
+
children: ["yield ", node]
|
|
2228
|
+
};
|
|
2229
|
+
});
|
|
2230
|
+
braceBlock(block);
|
|
2231
|
+
children.splice(
|
|
2232
|
+
i,
|
|
2233
|
+
1,
|
|
2234
|
+
wrapIIFE([
|
|
2235
|
+
["", statement, void 0],
|
|
2236
|
+
// Prevent implicit return in generator, by adding an explicit return
|
|
2237
|
+
["", {
|
|
2238
|
+
type: "ReturnStatement",
|
|
2239
|
+
expression: void 0,
|
|
2240
|
+
children: [";return"]
|
|
2241
|
+
}, void 0]
|
|
2242
|
+
], async, generator)
|
|
2243
|
+
);
|
|
2244
|
+
} else {
|
|
2245
|
+
exp.resultsRef ??= makeRef("results");
|
|
2246
|
+
const { resultsRef } = exp;
|
|
2247
|
+
assignResults(block, (node) => {
|
|
2248
|
+
return [resultsRef, ".push(", node, ")"];
|
|
2249
|
+
});
|
|
2250
|
+
braceBlock(block);
|
|
2251
|
+
children.splice(
|
|
2252
|
+
i,
|
|
2253
|
+
1,
|
|
2254
|
+
wrapIIFE([
|
|
2255
|
+
["", ["const ", resultsRef, "=[]"], ";"],
|
|
2256
|
+
["", statement, void 0],
|
|
2257
|
+
["", wrapWithReturn(resultsRef)]
|
|
2258
|
+
], async)
|
|
2259
|
+
);
|
|
2260
|
+
}
|
|
2131
2261
|
updateParentPointers(exp);
|
|
2132
2262
|
}
|
|
2133
2263
|
function skipImplicitArguments(args) {
|
|
@@ -2141,7 +2271,7 @@ ${body}`;
|
|
|
2141
2271
|
return false;
|
|
2142
2272
|
}
|
|
2143
2273
|
function processCoffeeDo(ws, expression) {
|
|
2144
|
-
ws =
|
|
2274
|
+
ws = trimFirstSpace(ws);
|
|
2145
2275
|
const args = [];
|
|
2146
2276
|
if (typeof expression === "object" && expression != null && "type" in expression && expression.type === "ArrowFunction" || typeof expression === "object" && expression != null && "type" in expression && expression.type === "FunctionExpression") {
|
|
2147
2277
|
const { parameters } = expression;
|
|
@@ -2175,7 +2305,7 @@ ${body}`;
|
|
|
2175
2305
|
expression = {
|
|
2176
2306
|
...expression,
|
|
2177
2307
|
parameters: newParameters,
|
|
2178
|
-
children: expression.children.map(($
|
|
2308
|
+
children: expression.children.map(($4) => $4 === parameters ? newParameters : $4)
|
|
2179
2309
|
};
|
|
2180
2310
|
}
|
|
2181
2311
|
return {
|
|
@@ -2196,7 +2326,7 @@ ${body}`;
|
|
|
2196
2326
|
ref = makeRef("$");
|
|
2197
2327
|
inplacePrepend(ref, body);
|
|
2198
2328
|
}
|
|
2199
|
-
if (startsWithPredicate(body, ($
|
|
2329
|
+
if (startsWithPredicate(body, ($5) => $5.type === "ObjectExpression")) {
|
|
2200
2330
|
body = makeLeftHandSideExpression(body);
|
|
2201
2331
|
}
|
|
2202
2332
|
const parameters = makeNode({
|
|
@@ -3457,7 +3587,7 @@ ${body}`;
|
|
|
3457
3587
|
const blockStatement = ["", statementExp];
|
|
3458
3588
|
let ref;
|
|
3459
3589
|
if (statementExp.type === "IterationExpression") {
|
|
3460
|
-
if (statementExp.async) {
|
|
3590
|
+
if (statementExp.async || statementExp.generator) {
|
|
3461
3591
|
return;
|
|
3462
3592
|
}
|
|
3463
3593
|
const statement2 = statementExp.statement;
|
|
@@ -4515,7 +4645,7 @@ ${body}`;
|
|
|
4515
4645
|
scopes.pop();
|
|
4516
4646
|
}
|
|
4517
4647
|
|
|
4518
|
-
// source/browser.civet
|
|
4648
|
+
// source/browser-shim.civet
|
|
4519
4649
|
function dirname(path) {
|
|
4520
4650
|
return path.replace(/[^]*\//, "");
|
|
4521
4651
|
}
|
|
@@ -4529,7 +4659,7 @@ ${body}`;
|
|
|
4529
4659
|
);
|
|
4530
4660
|
};
|
|
4531
4661
|
}
|
|
4532
|
-
var
|
|
4662
|
+
var browser_shim_default = {
|
|
4533
4663
|
dirname,
|
|
4534
4664
|
resolve,
|
|
4535
4665
|
createRequire
|
|
@@ -4672,12 +4802,12 @@ ${body}`;
|
|
|
4672
4802
|
}
|
|
4673
4803
|
let output, context, contextGlobal;
|
|
4674
4804
|
try {
|
|
4675
|
-
context =
|
|
4805
|
+
context = browser_shim_default.createContext?.() ?? globalThis;
|
|
4676
4806
|
const filename2 = context.__filename = resolve(getFilename() ?? "");
|
|
4677
4807
|
context.__dirname = dirname(filename2);
|
|
4678
4808
|
context.require = createRequire(filename2);
|
|
4679
|
-
if (
|
|
4680
|
-
contextGlobal =
|
|
4809
|
+
if (browser_shim_default.runInContext != null) {
|
|
4810
|
+
contextGlobal = browser_shim_default.runInContext("globalThis", context);
|
|
4681
4811
|
const builtins = new Set(Object.getOwnPropertyNames(contextGlobal));
|
|
4682
4812
|
for (const name of Object.getOwnPropertyNames(globalThis)) {
|
|
4683
4813
|
if (builtins.has(name)) {
|
|
@@ -4688,9 +4818,9 @@ ${body}`;
|
|
|
4688
4818
|
...Object.getOwnPropertyDescriptor(globalThis, name)
|
|
4689
4819
|
});
|
|
4690
4820
|
}
|
|
4691
|
-
output =
|
|
4821
|
+
output = browser_shim_default.runInContext(js, context, {
|
|
4692
4822
|
filename: filename2,
|
|
4693
|
-
importModuleDynamically:
|
|
4823
|
+
importModuleDynamically: browser_shim_default.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
4694
4824
|
});
|
|
4695
4825
|
} else {
|
|
4696
4826
|
output = eval?.(js);
|
|
@@ -6020,7 +6150,8 @@ ${js}`
|
|
|
6020
6150
|
type: "IterationExpression",
|
|
6021
6151
|
children: [statement],
|
|
6022
6152
|
block: statement.block,
|
|
6023
|
-
statement
|
|
6153
|
+
statement,
|
|
6154
|
+
generator: statement.generator
|
|
6024
6155
|
};
|
|
6025
6156
|
}
|
|
6026
6157
|
case "IfStatement": {
|
|
@@ -6547,6 +6678,7 @@ ${js}`
|
|
|
6547
6678
|
ReservedBinary,
|
|
6548
6679
|
ArgumentsWithTrailingMemberExpressions,
|
|
6549
6680
|
TrailingMemberExpressions,
|
|
6681
|
+
IndentedTrailingMemberExpression,
|
|
6550
6682
|
AllowedTrailingMemberExpressions,
|
|
6551
6683
|
TrailingCallExpressions,
|
|
6552
6684
|
AllowedTrailingCallExpressions,
|
|
@@ -6815,6 +6947,7 @@ ${js}`
|
|
|
6815
6947
|
BlockStatement,
|
|
6816
6948
|
LabelledStatement,
|
|
6817
6949
|
Label,
|
|
6950
|
+
LabelIdentifier,
|
|
6818
6951
|
LabelledItem,
|
|
6819
6952
|
IfStatement,
|
|
6820
6953
|
ElseClause,
|
|
@@ -7874,7 +8007,7 @@ ${js}`
|
|
|
7874
8007
|
function ExplicitArguments(ctx, state2) {
|
|
7875
8008
|
return (0, import_lib3.$EVENT)(ctx, state2, "ExplicitArguments", ExplicitArguments$0);
|
|
7876
8009
|
}
|
|
7877
|
-
var ApplicationStart$0 = (0, import_lib3.$S)(IndentedApplicationAllowed, (0, import_lib3.$Y)((0, import_lib3.$S)(IndentedFurther, (0, import_lib3.$N)(IdentifierBinaryOp), (0, import_lib3.$N)(
|
|
8010
|
+
var ApplicationStart$0 = (0, import_lib3.$S)(IndentedApplicationAllowed, (0, import_lib3.$Y)((0, import_lib3.$S)(IndentedFurther, (0, import_lib3.$N)(IdentifierBinaryOp))), (0, import_lib3.$N)(IndentedTrailingMemberExpression));
|
|
7878
8011
|
var ApplicationStart$1 = (0, import_lib3.$S)((0, import_lib3.$N)(EOS), (0, import_lib3.$Y)((0, import_lib3.$S)(_, (0, import_lib3.$C)(BracedApplicationAllowed, (0, import_lib3.$N)((0, import_lib3.$EXPECT)($L1, 'ApplicationStart "{"'))), (0, import_lib3.$N)(ForbiddenImplicitCalls))));
|
|
7879
8012
|
var ApplicationStart$$ = [ApplicationStart$0, ApplicationStart$1];
|
|
7880
8013
|
function ApplicationStart(ctx, state2) {
|
|
@@ -7915,20 +8048,20 @@ ${js}`
|
|
|
7915
8048
|
function ArgumentsWithTrailingMemberExpressions(ctx, state2) {
|
|
7916
8049
|
return (0, import_lib3.$EVENT)(ctx, state2, "ArgumentsWithTrailingMemberExpressions", ArgumentsWithTrailingMemberExpressions$0);
|
|
7917
8050
|
}
|
|
7918
|
-
var TrailingMemberExpressions$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Q)(MemberExpressionRest), (0, import_lib3.$Q)(
|
|
7919
|
-
return
|
|
7920
|
-
if (Array.isArray(memberExpressionRest)) {
|
|
7921
|
-
return [ws, ...memberExpressionRest];
|
|
7922
|
-
}
|
|
7923
|
-
return {
|
|
7924
|
-
...memberExpressionRest,
|
|
7925
|
-
children: [ws, ...memberExpressionRest.children]
|
|
7926
|
-
};
|
|
7927
|
-
}));
|
|
8051
|
+
var TrailingMemberExpressions$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Q)(MemberExpressionRest), (0, import_lib3.$Q)(IndentedTrailingMemberExpression)), function($skip, $loc, $0, $1, $2) {
|
|
8052
|
+
return [...$1, ...$2];
|
|
7928
8053
|
});
|
|
7929
8054
|
function TrailingMemberExpressions(ctx, state2) {
|
|
7930
8055
|
return (0, import_lib3.$EVENT)(ctx, state2, "TrailingMemberExpressions", TrailingMemberExpressions$0);
|
|
7931
8056
|
}
|
|
8057
|
+
var IndentedTrailingMemberExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(IndentedAtLeast, (0, import_lib3.$Y)((0, import_lib3.$S)((0, import_lib3.$E)((0, import_lib3.$EXPECT)($L6, 'IndentedTrailingMemberExpression "?"')), (0, import_lib3.$EXPECT)($L7, 'IndentedTrailingMemberExpression "."'), (0, import_lib3.$N)((0, import_lib3.$EXPECT)($R3, "IndentedTrailingMemberExpression /[0-9]/")))), MemberExpressionRest), function($skip, $loc, $0, $1, $2, $3) {
|
|
8058
|
+
var ws = $1;
|
|
8059
|
+
var rest = $3;
|
|
8060
|
+
return prepend(ws, rest);
|
|
8061
|
+
});
|
|
8062
|
+
function IndentedTrailingMemberExpression(ctx, state2) {
|
|
8063
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "IndentedTrailingMemberExpression", IndentedTrailingMemberExpression$0);
|
|
8064
|
+
}
|
|
7932
8065
|
var AllowedTrailingMemberExpressions$0 = (0, import_lib3.$T)((0, import_lib3.$S)(TrailingMemberPropertyAllowed, TrailingMemberExpressions), function(value) {
|
|
7933
8066
|
return value[1];
|
|
7934
8067
|
});
|
|
@@ -12472,8 +12605,10 @@ ${js}`
|
|
|
12472
12605
|
var Statement$2 = (0, import_lib3.$T)((0, import_lib3.$S)(IfStatement, (0, import_lib3.$N)(ShouldExpressionize)), function(value) {
|
|
12473
12606
|
return value[0];
|
|
12474
12607
|
});
|
|
12475
|
-
var Statement$3 = (0, import_lib3.$
|
|
12476
|
-
|
|
12608
|
+
var Statement$3 = (0, import_lib3.$TS)((0, import_lib3.$S)(IterationStatement, (0, import_lib3.$N)(ShouldExpressionize)), function($skip, $loc, $0, $1, $2) {
|
|
12609
|
+
if ($1.generator)
|
|
12610
|
+
return $skip;
|
|
12611
|
+
return $1;
|
|
12477
12612
|
});
|
|
12478
12613
|
var Statement$4 = (0, import_lib3.$T)((0, import_lib3.$S)(SwitchStatement, (0, import_lib3.$N)(ShouldExpressionize)), function(value) {
|
|
12479
12614
|
return value[0];
|
|
@@ -12544,11 +12679,22 @@ ${js}`
|
|
|
12544
12679
|
var colon = $1;
|
|
12545
12680
|
var id = $2;
|
|
12546
12681
|
var w = $3;
|
|
12547
|
-
return
|
|
12682
|
+
return {
|
|
12683
|
+
type: "Label",
|
|
12684
|
+
name: id.name,
|
|
12685
|
+
children: [id, colon, w]
|
|
12686
|
+
};
|
|
12548
12687
|
});
|
|
12549
12688
|
function Label(ctx, state2) {
|
|
12550
12689
|
return (0, import_lib3.$EVENT)(ctx, state2, "Label", Label$0);
|
|
12551
12690
|
}
|
|
12691
|
+
var LabelIdentifier$0 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$E)(Colon), Identifier), function(value) {
|
|
12692
|
+
var id = value[1];
|
|
12693
|
+
return id;
|
|
12694
|
+
});
|
|
12695
|
+
function LabelIdentifier(ctx, state2) {
|
|
12696
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "LabelIdentifier", LabelIdentifier$0);
|
|
12697
|
+
}
|
|
12552
12698
|
var LabelledItem$0 = Statement;
|
|
12553
12699
|
var LabelledItem$1 = FunctionDeclaration;
|
|
12554
12700
|
var LabelledItem$$ = [LabelledItem$0, LabelledItem$1];
|
|
@@ -12645,7 +12791,8 @@ ${js}`
|
|
|
12645
12791
|
children: [statement],
|
|
12646
12792
|
block: statement.block,
|
|
12647
12793
|
statement,
|
|
12648
|
-
async
|
|
12794
|
+
async,
|
|
12795
|
+
generator: statement.generator
|
|
12649
12796
|
};
|
|
12650
12797
|
});
|
|
12651
12798
|
function IterationExpression(ctx, state2) {
|
|
@@ -12664,8 +12811,9 @@ ${js}`
|
|
|
12664
12811
|
function LoopStatement(ctx, state2) {
|
|
12665
12812
|
return (0, import_lib3.$EVENT)(ctx, state2, "LoopStatement", LoopStatement$0);
|
|
12666
12813
|
}
|
|
12667
|
-
var LoopClause$0 = (0, import_lib3.$
|
|
12668
|
-
var kind = $
|
|
12814
|
+
var LoopClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Loop, (0, import_lib3.$E)((0, import_lib3.$S)((0, import_lib3.$E)(_), Star))), function($skip, $loc, $0, $1, $2) {
|
|
12815
|
+
var kind = $1;
|
|
12816
|
+
var generator = $2;
|
|
12669
12817
|
const expression = {
|
|
12670
12818
|
type: "Literal",
|
|
12671
12819
|
children: ["true"],
|
|
@@ -12680,33 +12828,41 @@ ${js}`
|
|
|
12680
12828
|
type: "IterationStatement",
|
|
12681
12829
|
subtype: kind.token,
|
|
12682
12830
|
children: [kind, condition],
|
|
12683
|
-
condition
|
|
12831
|
+
condition,
|
|
12832
|
+
generator
|
|
12684
12833
|
};
|
|
12685
12834
|
});
|
|
12686
12835
|
function LoopClause(ctx, state2) {
|
|
12687
12836
|
return (0, import_lib3.$EVENT)(ctx, state2, "LoopClause", LoopClause$0);
|
|
12688
12837
|
}
|
|
12689
|
-
var DoWhileStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Do, NoPostfixBracedOrEmptyBlock, __, WhileClause), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12690
|
-
var
|
|
12691
|
-
var
|
|
12838
|
+
var DoWhileStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Do, (0, import_lib3.$E)((0, import_lib3.$S)((0, import_lib3.$E)(_), Star)), NoPostfixBracedOrEmptyBlock, __, WhileClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
12839
|
+
var d = $1;
|
|
12840
|
+
var generator = $2;
|
|
12841
|
+
var block = $3;
|
|
12842
|
+
var ws = $4;
|
|
12843
|
+
var clause = $5;
|
|
12692
12844
|
return {
|
|
12693
12845
|
...clause,
|
|
12694
12846
|
type: "IterationStatement",
|
|
12695
12847
|
subtype: "do-while",
|
|
12696
|
-
children:
|
|
12697
|
-
block
|
|
12848
|
+
children: [d, block, ws, clause],
|
|
12849
|
+
block,
|
|
12850
|
+
generator
|
|
12698
12851
|
};
|
|
12699
12852
|
});
|
|
12700
12853
|
function DoWhileStatement(ctx, state2) {
|
|
12701
12854
|
return (0, import_lib3.$EVENT)(ctx, state2, "DoWhileStatement", DoWhileStatement$0);
|
|
12702
12855
|
}
|
|
12703
|
-
var DoStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Do, NoPostfixBracedOrEmptyBlock), function($skip, $loc, $0, $1, $2) {
|
|
12704
|
-
var
|
|
12856
|
+
var DoStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Do, (0, import_lib3.$E)((0, import_lib3.$S)((0, import_lib3.$E)(_), Star)), NoPostfixBracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3) {
|
|
12857
|
+
var d = $1;
|
|
12858
|
+
var generator = $2;
|
|
12859
|
+
var block = $3;
|
|
12705
12860
|
block = trimFirstSpace(block);
|
|
12706
12861
|
return {
|
|
12707
12862
|
type: "DoStatement",
|
|
12708
12863
|
children: [block],
|
|
12709
|
-
block
|
|
12864
|
+
block,
|
|
12865
|
+
generator
|
|
12710
12866
|
};
|
|
12711
12867
|
});
|
|
12712
12868
|
function DoStatement(ctx, state2) {
|
|
@@ -12741,10 +12897,11 @@ ${js}`
|
|
|
12741
12897
|
function WhileStatement(ctx, state2) {
|
|
12742
12898
|
return (0, import_lib3.$EVENT)(ctx, state2, "WhileStatement", WhileStatement$0);
|
|
12743
12899
|
}
|
|
12744
|
-
var WhileClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$C)(While, Until), (0, import_lib3.$E)(_), Condition), function($skip, $loc, $0, $1, $2, $3) {
|
|
12900
|
+
var WhileClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$C)(While, Until), (0, import_lib3.$E)((0, import_lib3.$S)((0, import_lib3.$E)(_), Star)), (0, import_lib3.$E)(_), Condition), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12745
12901
|
var kind = $1;
|
|
12746
|
-
var
|
|
12747
|
-
var
|
|
12902
|
+
var generator = $2;
|
|
12903
|
+
var ws = $3;
|
|
12904
|
+
var condition = $4;
|
|
12748
12905
|
if (kind.negated) {
|
|
12749
12906
|
kind = { ...kind, token: "while" };
|
|
12750
12907
|
condition = negateCondition(condition);
|
|
@@ -12754,6 +12911,7 @@ ${js}`
|
|
|
12754
12911
|
subtype: kind.token,
|
|
12755
12912
|
children: [kind, ws, condition],
|
|
12756
12913
|
condition,
|
|
12914
|
+
generator,
|
|
12757
12915
|
negated: kind.negated
|
|
12758
12916
|
};
|
|
12759
12917
|
});
|
|
@@ -12773,16 +12931,18 @@ ${js}`
|
|
|
12773
12931
|
function ForStatement(ctx, state2) {
|
|
12774
12932
|
return (0, import_lib3.$EVENT)(ctx, state2, "ForStatement", ForStatement$0);
|
|
12775
12933
|
}
|
|
12776
|
-
var ForClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(For, __, ForStatementControl), function($skip, $loc, $0, $1, $2, $3) {
|
|
12777
|
-
var
|
|
12934
|
+
var ForClause$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(For, (0, import_lib3.$E)((0, import_lib3.$S)((0, import_lib3.$E)(_), Star)), __, ForStatementControl), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12935
|
+
var generator = $2;
|
|
12936
|
+
var c = $4;
|
|
12778
12937
|
const { children, declaration } = c;
|
|
12779
12938
|
return {
|
|
12780
12939
|
type: "ForStatement",
|
|
12781
|
-
children: [$1, ...$
|
|
12940
|
+
children: [$1, ...$3, ...children],
|
|
12782
12941
|
declaration,
|
|
12783
12942
|
block: null,
|
|
12784
12943
|
blockPrefix: c.blockPrefix,
|
|
12785
|
-
hoistDec: c.hoistDec
|
|
12944
|
+
hoistDec: c.hoistDec,
|
|
12945
|
+
generator
|
|
12786
12946
|
};
|
|
12787
12947
|
});
|
|
12788
12948
|
function ForClause(ctx, state2) {
|
|
@@ -13549,11 +13709,21 @@ ${js}`
|
|
|
13549
13709
|
function ExpressionStatement(ctx, state2) {
|
|
13550
13710
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "ExpressionStatement", ExpressionStatement$$);
|
|
13551
13711
|
}
|
|
13552
|
-
var KeywordStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Break, (0, import_lib3.$E)((0, import_lib3.$S)(_, (0, import_lib3.$E)(
|
|
13712
|
+
var KeywordStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Break, (0, import_lib3.$E)((0, import_lib3.$S)(_, LabelIdentifier)), (0, import_lib3.$E)((0, import_lib3.$S)(_, With, MaybeNestedExtendedExpression))), function($skip, $loc, $0, $1, $2, $3) {
|
|
13713
|
+
const children = [$1];
|
|
13714
|
+
if ($2)
|
|
13715
|
+
children.push($2);
|
|
13716
|
+
if ($3)
|
|
13717
|
+
children.push({
|
|
13718
|
+
type: "Error",
|
|
13719
|
+
subtype: "Warning",
|
|
13720
|
+
message: "'break with' outside of loop that returns a value"
|
|
13721
|
+
});
|
|
13553
13722
|
return {
|
|
13554
13723
|
type: "BreakStatement",
|
|
13555
|
-
|
|
13556
|
-
|
|
13724
|
+
label: $2?.[1],
|
|
13725
|
+
with: $3?.[2],
|
|
13726
|
+
children
|
|
13557
13727
|
};
|
|
13558
13728
|
});
|
|
13559
13729
|
var KeywordStatement$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(Continue, _, Switch), function($skip, $loc, $0, $1, $2, $3) {
|
|
@@ -13563,11 +13733,21 @@ ${js}`
|
|
|
13563
13733
|
children: []
|
|
13564
13734
|
};
|
|
13565
13735
|
});
|
|
13566
|
-
var KeywordStatement$2 = (0, import_lib3.$TS)((0, import_lib3.$S)(Continue, (0, import_lib3.$E)((0, import_lib3.$S)(_, (0, import_lib3.$E)(
|
|
13736
|
+
var KeywordStatement$2 = (0, import_lib3.$TS)((0, import_lib3.$S)(Continue, (0, import_lib3.$E)((0, import_lib3.$S)(_, LabelIdentifier)), (0, import_lib3.$E)((0, import_lib3.$S)(_, With, MaybeNestedExtendedExpression))), function($skip, $loc, $0, $1, $2, $3) {
|
|
13737
|
+
const children = [$1];
|
|
13738
|
+
if ($2)
|
|
13739
|
+
children.push($2);
|
|
13740
|
+
if ($3)
|
|
13741
|
+
children.push({
|
|
13742
|
+
type: "Error",
|
|
13743
|
+
subtype: "Warning",
|
|
13744
|
+
message: "'continue with' outside of loop that returns a value"
|
|
13745
|
+
});
|
|
13567
13746
|
return {
|
|
13568
13747
|
type: "ContinueStatement",
|
|
13569
|
-
|
|
13570
|
-
|
|
13748
|
+
label: $2?.[1],
|
|
13749
|
+
with: $3?.[2],
|
|
13750
|
+
children
|
|
13571
13751
|
};
|
|
13572
13752
|
});
|
|
13573
13753
|
var KeywordStatement$3 = DebuggerStatement;
|
|
@@ -17716,19 +17896,6 @@ ${js}`
|
|
|
17716
17896
|
}
|
|
17717
17897
|
});
|
|
17718
17898
|
Object.assign(config, initialConfig);
|
|
17719
|
-
return {
|
|
17720
|
-
type: "ParserMeta",
|
|
17721
|
-
children: [],
|
|
17722
|
-
getStateKey() {
|
|
17723
|
-
const stateInt = state.currentIndent.level % 256 << 8 | state.classImplicitCallForbidden << 7 | state.indentedApplicationForbidden << 6 | state.bracedApplicationForbidden << 5 | state.trailingMemberPropertyForbidden << 4 | state.newlineBinaryOpForbidden << 3 | // This is slightly different than the rest of the state,
|
|
17724
|
-
// since it is affected by the directive prologue and may be hit
|
|
17725
|
-
// by the EOL rule early in the parse. Later if we wanted to
|
|
17726
|
-
// allow block scoping of the compat directives we would need to
|
|
17727
|
-
// add them all here.
|
|
17728
|
-
config.coffeeComment << 2;
|
|
17729
|
-
return [stateInt, state.currentJSXTag];
|
|
17730
|
-
}
|
|
17731
|
-
};
|
|
17732
17899
|
});
|
|
17733
17900
|
function Reset(ctx, state2) {
|
|
17734
17901
|
return (0, import_lib3.$EVENT)(ctx, state2, "Reset", Reset$0);
|
|
@@ -17930,6 +18097,15 @@ ${js}`
|
|
|
17930
18097
|
}
|
|
17931
18098
|
}
|
|
17932
18099
|
});
|
|
18100
|
+
function getStateKey() {
|
|
18101
|
+
const stateInt = state.currentIndent.level % 256 << 8 | state.classImplicitCallForbidden << 7 | state.indentedApplicationForbidden << 6 | state.bracedApplicationForbidden << 5 | state.trailingMemberPropertyForbidden << 4 | state.newlineBinaryOpForbidden << 3 | // This is slightly different than the rest of the state,
|
|
18102
|
+
// since it is affected by the directive prologue and may be hit
|
|
18103
|
+
// by the EOL rule early in the parse. Later if we wanted to
|
|
18104
|
+
// allow block scoping of the compat directives we would need to
|
|
18105
|
+
// add them all here.
|
|
18106
|
+
config.coffeeComment << 2;
|
|
18107
|
+
return [stateInt, state.currentJSXTag];
|
|
18108
|
+
}
|
|
17933
18109
|
function parseProgram(input, options) {
|
|
17934
18110
|
filename = options?.filename;
|
|
17935
18111
|
initialConfig = options?.parseOptions;
|
|
@@ -18156,7 +18332,11 @@ ${js}`
|
|
|
18156
18332
|
})();
|
|
18157
18333
|
};
|
|
18158
18334
|
var base64Encode = function(src) {
|
|
18159
|
-
|
|
18335
|
+
if (typeof Buffer !== "undefined") {
|
|
18336
|
+
return Buffer.from(src).toString("base64");
|
|
18337
|
+
} else {
|
|
18338
|
+
return btoa(src);
|
|
18339
|
+
}
|
|
18160
18340
|
};
|
|
18161
18341
|
var vlqTable = new Uint8Array(128);
|
|
18162
18342
|
var vlqChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
@@ -18460,7 +18640,6 @@ ${counts}`;
|
|
|
18460
18640
|
meta.logs = logs;
|
|
18461
18641
|
}
|
|
18462
18642
|
const stateCache = new StateCache();
|
|
18463
|
-
let getStateKey = null;
|
|
18464
18643
|
const stack = [];
|
|
18465
18644
|
const events = {
|
|
18466
18645
|
meta,
|
|
@@ -18489,14 +18668,12 @@ ${counts}`;
|
|
|
18489
18668
|
return;
|
|
18490
18669
|
},
|
|
18491
18670
|
exit: function(ruleName, state2, result) {
|
|
18492
|
-
if (ruleName
|
|
18493
|
-
|
|
18494
|
-
}
|
|
18495
|
-
if (!uncacheable.has(ruleName)) {
|
|
18496
|
-
const [stateKey, tagKey] = getStateKey();
|
|
18497
|
-
const key = [tagKey, stateKey, state2.pos, ruleName];
|
|
18498
|
-
stateCache.set(key, result);
|
|
18671
|
+
if (uncacheable.has(ruleName)) {
|
|
18672
|
+
return;
|
|
18499
18673
|
}
|
|
18674
|
+
const [stateKey, tagKey] = getStateKey();
|
|
18675
|
+
const key = [tagKey, stateKey, state2.pos, ruleName];
|
|
18676
|
+
stateCache.set(key, result);
|
|
18500
18677
|
if (getConfig().verbose && result) {
|
|
18501
18678
|
console.log(`Parsed ${JSON.stringify(state2.input.slice(state2.pos, result.pos))} [pos ${state2.pos}-${result.pos}] as ${ruleName}`);
|
|
18502
18679
|
}
|
|
@@ -18512,6 +18689,71 @@ ${counts}`;
|
|
|
18512
18689
|
var isCompileError = function(err) {
|
|
18513
18690
|
return err instanceof import_lib3.ParseError || err instanceof ParseErrors;
|
|
18514
18691
|
};
|
|
18515
|
-
|
|
18516
|
-
|
|
18692
|
+
|
|
18693
|
+
// source/browser.civet
|
|
18694
|
+
async function runScripts(type = "text/civet") {
|
|
18695
|
+
const scripts = window.document.querySelectorAll(`script[type=${JSON.stringify(type)}]`);
|
|
18696
|
+
for (let i1 = 0, len3 = scripts.length; i1 < len3; i1++) {
|
|
18697
|
+
const i = i1;
|
|
18698
|
+
const script = scripts[i1];
|
|
18699
|
+
runScript(script, `<script>${i}`);
|
|
18700
|
+
}
|
|
18701
|
+
}
|
|
18702
|
+
async function runScript(script, name = "<script>") {
|
|
18703
|
+
const options = {
|
|
18704
|
+
inlineMap: true,
|
|
18705
|
+
js: true
|
|
18706
|
+
};
|
|
18707
|
+
let code;
|
|
18708
|
+
let ref;
|
|
18709
|
+
if (ref = script.src || script.getAttribute("data-src")) {
|
|
18710
|
+
const source = ref;
|
|
18711
|
+
options.filename = source;
|
|
18712
|
+
code = await (await fetch(source)).text();
|
|
18713
|
+
} else {
|
|
18714
|
+
options.filename = script.id || name;
|
|
18715
|
+
code = script.innerHTML;
|
|
18716
|
+
}
|
|
18717
|
+
const js = await compile(code, options);
|
|
18718
|
+
return window.eval(js);
|
|
18719
|
+
}
|
|
18720
|
+
function autoRunScripts(roots, options = {}) {
|
|
18721
|
+
const observer = new MutationObserver(async (mutations) => {
|
|
18722
|
+
for (let i2 = 0, len1 = mutations.length; i2 < len1; i2++) {
|
|
18723
|
+
const mutation = mutations[i2];
|
|
18724
|
+
if (!(mutation.type === "childList")) {
|
|
18725
|
+
continue;
|
|
18726
|
+
}
|
|
18727
|
+
for (let ref1 = mutation.addedNodes, i3 = 0, len22 = ref1.length; i3 < len22; i3++) {
|
|
18728
|
+
const node = ref1[i3];
|
|
18729
|
+
if (node.nodeType === 1 && node.tagName === "SCRIPT" && node.type === "text/civet") {
|
|
18730
|
+
await runScript(node);
|
|
18731
|
+
}
|
|
18732
|
+
}
|
|
18733
|
+
}
|
|
18734
|
+
});
|
|
18735
|
+
options = { ...options, childList: true };
|
|
18736
|
+
for (let i4 = 0, len3 = roots.length; i4 < len3; i4++) {
|
|
18737
|
+
const root = roots[i4];
|
|
18738
|
+
observer.observe(root, options);
|
|
18739
|
+
}
|
|
18740
|
+
return observer;
|
|
18741
|
+
}
|
|
18742
|
+
if (!(typeof window === "undefined")) {
|
|
18743
|
+
const { currentScript } = document;
|
|
18744
|
+
window?.addEventListener?.("DOMContentLoaded", () => {
|
|
18745
|
+
if (currentScript?.hasAttribute("data-no-scripts")) {
|
|
18746
|
+
return;
|
|
18747
|
+
}
|
|
18748
|
+
if (!currentScript?.hasAttribute("data-no-start-scripts")) {
|
|
18749
|
+
runScripts();
|
|
18750
|
+
}
|
|
18751
|
+
if (!currentScript?.hasAttribute("data-no-auto-scripts")) {
|
|
18752
|
+
return autoRunScripts([document.head, document.body]);
|
|
18753
|
+
}
|
|
18754
|
+
;
|
|
18755
|
+
return;
|
|
18756
|
+
});
|
|
18757
|
+
}
|
|
18758
|
+
return __toCommonJS(browser_exports);
|
|
18517
18759
|
})();
|