@stacksjs/database 0.61.20 → 0.61.21
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/dist/index.js +794 -741
- package/package.json +4 -4
- package/src/drivers/index.ts +34 -16
- package/src/drivers/mysql.ts +11 -11
- package/src/drivers/postgres.ts +13 -13
- package/src/drivers/sqlite.ts +11 -11
package/dist/index.js
CHANGED
|
@@ -30790,11 +30790,11 @@ var require_visitors = __commonJS((exports) => {
|
|
|
30790
30790
|
}
|
|
30791
30791
|
visitor._verified = true;
|
|
30792
30792
|
};
|
|
30793
|
-
var validateVisitorMethods = function(
|
|
30793
|
+
var validateVisitorMethods = function(path2, val) {
|
|
30794
30794
|
const fns = [].concat(val);
|
|
30795
30795
|
for (const fn of fns) {
|
|
30796
30796
|
if (typeof fn !== "function") {
|
|
30797
|
-
throw new TypeError(`Non-function found defined in ${
|
|
30797
|
+
throw new TypeError(`Non-function found defined in ${path2} with type ${typeof fn}`);
|
|
30798
30798
|
}
|
|
30799
30799
|
}
|
|
30800
30800
|
};
|
|
@@ -30830,8 +30830,8 @@ var require_visitors = __commonJS((exports) => {
|
|
|
30830
30830
|
fns = fns.map(function(fn) {
|
|
30831
30831
|
let newFn = fn;
|
|
30832
30832
|
if (state) {
|
|
30833
|
-
newFn = function(
|
|
30834
|
-
fn.call(state,
|
|
30833
|
+
newFn = function(path2) {
|
|
30834
|
+
fn.call(state, path2, state);
|
|
30835
30835
|
};
|
|
30836
30836
|
}
|
|
30837
30837
|
if (wrapper) {
|
|
@@ -30867,8 +30867,8 @@ var require_visitors = __commonJS((exports) => {
|
|
|
30867
30867
|
var wrapCheck = function(nodeType, fn) {
|
|
30868
30868
|
const fnKey = `is${nodeType}`;
|
|
30869
30869
|
const validator = virtualTypesValidators[fnKey];
|
|
30870
|
-
const newFn = function(
|
|
30871
|
-
if (validator.call(
|
|
30870
|
+
const newFn = function(path2) {
|
|
30871
|
+
if (validator.call(path2)) {
|
|
30872
30872
|
return fn.apply(this, arguments);
|
|
30873
30873
|
}
|
|
30874
30874
|
};
|
|
@@ -30962,7 +30962,7 @@ var require_cache = __commonJS((exports) => {
|
|
|
30962
30962
|
var nullHub = Object.freeze({});
|
|
30963
30963
|
});
|
|
30964
30964
|
|
|
30965
|
-
// ../../../../node_modules/
|
|
30965
|
+
// ../../../../node_modules/ms/index.js
|
|
30966
30966
|
var require_ms = __commonJS((exports, module) => {
|
|
30967
30967
|
var parse = function(str) {
|
|
30968
30968
|
str = String(str);
|
|
@@ -31072,7 +31072,7 @@ var require_ms = __commonJS((exports, module) => {
|
|
|
31072
31072
|
};
|
|
31073
31073
|
});
|
|
31074
31074
|
|
|
31075
|
-
// ../../../../node_modules/debug/src/common.js
|
|
31075
|
+
// ../../../../node_modules/@babel/traverse/node_modules/debug/src/common.js
|
|
31076
31076
|
var require_common = __commonJS((exports, module) => {
|
|
31077
31077
|
var setup = function(env3) {
|
|
31078
31078
|
createDebug.debug = createDebug;
|
|
@@ -31233,7 +31233,7 @@ var require_common = __commonJS((exports, module) => {
|
|
|
31233
31233
|
module.exports = setup;
|
|
31234
31234
|
});
|
|
31235
31235
|
|
|
31236
|
-
// ../../../../node_modules/debug/src/browser.js
|
|
31236
|
+
// ../../../../node_modules/@babel/traverse/node_modules/debug/src/browser.js
|
|
31237
31237
|
var require_browser = __commonJS((exports, module) => {
|
|
31238
31238
|
var useColors = function() {
|
|
31239
31239
|
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
|
|
@@ -31505,7 +31505,7 @@ var require_supports_color = __commonJS((exports, module) => {
|
|
|
31505
31505
|
};
|
|
31506
31506
|
});
|
|
31507
31507
|
|
|
31508
|
-
// ../../../../node_modules/debug/src/node.js
|
|
31508
|
+
// ../../../../node_modules/@babel/traverse/node_modules/debug/src/node.js
|
|
31509
31509
|
var require_node = __commonJS((exports, module) => {
|
|
31510
31510
|
var useColors = function() {
|
|
31511
31511
|
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty3.isatty(process.stderr.fd);
|
|
@@ -31674,7 +31674,7 @@ var require_node = __commonJS((exports, module) => {
|
|
|
31674
31674
|
};
|
|
31675
31675
|
});
|
|
31676
31676
|
|
|
31677
|
-
// ../../../../node_modules/debug/src/index.js
|
|
31677
|
+
// ../../../../node_modules/@babel/traverse/node_modules/debug/src/index.js
|
|
31678
31678
|
var require_src = __commonJS((exports, module) => {
|
|
31679
31679
|
if (typeof process === "undefined" || process.type === "renderer" || false || process.__nwjs) {
|
|
31680
31680
|
module.exports = require_browser();
|
|
@@ -31744,16 +31744,16 @@ var require_lib5 = __commonJS((exports) => {
|
|
|
31744
31744
|
|
|
31745
31745
|
// ../../../../node_modules/@babel/helper-environment-visitor/lib/index.js
|
|
31746
31746
|
var require_lib6 = __commonJS((exports) => {
|
|
31747
|
-
var requeueComputedKeyAndDecorators = function(
|
|
31747
|
+
var requeueComputedKeyAndDecorators = function(path2) {
|
|
31748
31748
|
const {
|
|
31749
31749
|
context,
|
|
31750
31750
|
node
|
|
31751
|
-
} =
|
|
31751
|
+
} = path2;
|
|
31752
31752
|
if (node.computed) {
|
|
31753
|
-
context.maybeQueue(
|
|
31753
|
+
context.maybeQueue(path2.get("key"));
|
|
31754
31754
|
}
|
|
31755
31755
|
if (node.decorators) {
|
|
31756
|
-
for (const decorator of
|
|
31756
|
+
for (const decorator of path2.get("decorators")) {
|
|
31757
31757
|
context.maybeQueue(decorator);
|
|
31758
31758
|
}
|
|
31759
31759
|
}
|
|
@@ -31764,30 +31764,30 @@ var require_lib6 = __commonJS((exports) => {
|
|
|
31764
31764
|
exports.default = undefined;
|
|
31765
31765
|
exports.requeueComputedKeyAndDecorators = requeueComputedKeyAndDecorators;
|
|
31766
31766
|
{
|
|
31767
|
-
exports.skipAllButComputedKey = function skipAllButComputedKey(
|
|
31768
|
-
|
|
31769
|
-
if (
|
|
31770
|
-
|
|
31767
|
+
exports.skipAllButComputedKey = function skipAllButComputedKey(path2) {
|
|
31768
|
+
path2.skip();
|
|
31769
|
+
if (path2.node.computed) {
|
|
31770
|
+
path2.context.maybeQueue(path2.get("key"));
|
|
31771
31771
|
}
|
|
31772
31772
|
};
|
|
31773
31773
|
}
|
|
31774
31774
|
var visitor = {
|
|
31775
|
-
FunctionParent(
|
|
31776
|
-
if (
|
|
31775
|
+
FunctionParent(path2) {
|
|
31776
|
+
if (path2.isArrowFunctionExpression()) {
|
|
31777
31777
|
return;
|
|
31778
31778
|
} else {
|
|
31779
|
-
|
|
31780
|
-
if (
|
|
31781
|
-
requeueComputedKeyAndDecorators(
|
|
31779
|
+
path2.skip();
|
|
31780
|
+
if (path2.isMethod()) {
|
|
31781
|
+
requeueComputedKeyAndDecorators(path2);
|
|
31782
31782
|
}
|
|
31783
31783
|
}
|
|
31784
31784
|
},
|
|
31785
|
-
Property(
|
|
31786
|
-
if (
|
|
31785
|
+
Property(path2) {
|
|
31786
|
+
if (path2.isObjectProperty()) {
|
|
31787
31787
|
return;
|
|
31788
31788
|
}
|
|
31789
|
-
|
|
31790
|
-
requeueComputedKeyAndDecorators(
|
|
31789
|
+
path2.skip();
|
|
31790
|
+
requeueComputedKeyAndDecorators(path2);
|
|
31791
31791
|
}
|
|
31792
31792
|
};
|
|
31793
31793
|
var _default = visitor;
|
|
@@ -31813,11 +31813,11 @@ var require_renamer = __commonJS((exports) => {
|
|
|
31813
31813
|
node.name = state.newName;
|
|
31814
31814
|
}
|
|
31815
31815
|
},
|
|
31816
|
-
Scope(
|
|
31817
|
-
if (!
|
|
31818
|
-
|
|
31819
|
-
if (
|
|
31820
|
-
(0, _helperEnvironmentVisitor.requeueComputedKeyAndDecorators)(
|
|
31816
|
+
Scope(path2, state) {
|
|
31817
|
+
if (!path2.scope.bindingIdentifierEquals(state.oldName, state.binding.identifier)) {
|
|
31818
|
+
path2.skip();
|
|
31819
|
+
if (path2.isMethod()) {
|
|
31820
|
+
(0, _helperEnvironmentVisitor.requeueComputedKeyAndDecorators)(path2);
|
|
31821
31821
|
}
|
|
31822
31822
|
}
|
|
31823
31823
|
},
|
|
@@ -31835,10 +31835,10 @@ var require_renamer = __commonJS((exports) => {
|
|
|
31835
31835
|
node.extra.shorthand = false;
|
|
31836
31836
|
}
|
|
31837
31837
|
},
|
|
31838
|
-
"AssignmentExpression|Declaration|VariableDeclarator"(
|
|
31839
|
-
if (
|
|
31838
|
+
"AssignmentExpression|Declaration|VariableDeclarator"(path2, state) {
|
|
31839
|
+
if (path2.isVariableDeclaration())
|
|
31840
31840
|
return;
|
|
31841
|
-
const ids =
|
|
31841
|
+
const ids = path2.getOuterBindingIdentifiers();
|
|
31842
31842
|
for (const name in ids) {
|
|
31843
31843
|
if (name === state.oldName)
|
|
31844
31844
|
ids[name].name = state.newName;
|
|
@@ -31870,11 +31870,11 @@ var require_renamer = __commonJS((exports) => {
|
|
|
31870
31870
|
}
|
|
31871
31871
|
(0, _helperSplitExportDeclaration.default)(maybeExportDeclar);
|
|
31872
31872
|
}
|
|
31873
|
-
maybeConvertFromClassFunctionDeclaration(
|
|
31874
|
-
return
|
|
31873
|
+
maybeConvertFromClassFunctionDeclaration(path2) {
|
|
31874
|
+
return path2;
|
|
31875
31875
|
}
|
|
31876
|
-
maybeConvertFromClassFunctionExpression(
|
|
31877
|
-
return
|
|
31876
|
+
maybeConvertFromClassFunctionExpression(path2) {
|
|
31877
|
+
return path2;
|
|
31878
31878
|
}
|
|
31879
31879
|
rename() {
|
|
31880
31880
|
const {
|
|
@@ -31884,9 +31884,9 @@ var require_renamer = __commonJS((exports) => {
|
|
|
31884
31884
|
} = this;
|
|
31885
31885
|
const {
|
|
31886
31886
|
scope,
|
|
31887
|
-
path:
|
|
31887
|
+
path: path2
|
|
31888
31888
|
} = binding;
|
|
31889
|
-
const parentDeclar =
|
|
31889
|
+
const parentDeclar = path2.find((path3) => path3.isDeclaration() || path3.isFunctionExpression() || path3.isClassExpression());
|
|
31890
31890
|
if (parentDeclar) {
|
|
31891
31891
|
const bindingIds = parentDeclar.getOuterBindingIdentifiers();
|
|
31892
31892
|
if (bindingIds[oldName] === binding.identifier) {
|
|
@@ -31903,8 +31903,8 @@ var require_renamer = __commonJS((exports) => {
|
|
|
31903
31903
|
this.binding.identifier.name = newName;
|
|
31904
31904
|
}
|
|
31905
31905
|
if (parentDeclar) {
|
|
31906
|
-
this.maybeConvertFromClassFunctionDeclaration(
|
|
31907
|
-
this.maybeConvertFromClassFunctionExpression(
|
|
31906
|
+
this.maybeConvertFromClassFunctionDeclaration(path2);
|
|
31907
|
+
this.maybeConvertFromClassFunctionExpression(path2);
|
|
31908
31908
|
}
|
|
31909
31909
|
}
|
|
31910
31910
|
}
|
|
@@ -31913,11 +31913,11 @@ var require_renamer = __commonJS((exports) => {
|
|
|
31913
31913
|
|
|
31914
31914
|
// ../../../../node_modules/@babel/traverse/lib/scope/binding.js
|
|
31915
31915
|
var require_binding = __commonJS((exports) => {
|
|
31916
|
-
var isDeclaredInLoop = function(
|
|
31916
|
+
var isDeclaredInLoop = function(path2) {
|
|
31917
31917
|
for (let {
|
|
31918
31918
|
parentPath,
|
|
31919
31919
|
key
|
|
31920
|
-
} =
|
|
31920
|
+
} = path2;parentPath; {
|
|
31921
31921
|
parentPath,
|
|
31922
31922
|
key
|
|
31923
31923
|
} = parentPath) {
|
|
@@ -31938,7 +31938,7 @@ var require_binding = __commonJS((exports) => {
|
|
|
31938
31938
|
constructor({
|
|
31939
31939
|
identifier,
|
|
31940
31940
|
scope,
|
|
31941
|
-
path:
|
|
31941
|
+
path: path2,
|
|
31942
31942
|
kind
|
|
31943
31943
|
}) {
|
|
31944
31944
|
this.identifier = undefined;
|
|
@@ -31952,10 +31952,10 @@ var require_binding = __commonJS((exports) => {
|
|
|
31952
31952
|
this.references = 0;
|
|
31953
31953
|
this.identifier = identifier;
|
|
31954
31954
|
this.scope = scope;
|
|
31955
|
-
this.path =
|
|
31955
|
+
this.path = path2;
|
|
31956
31956
|
this.kind = kind;
|
|
31957
|
-
if ((kind === "var" || kind === "hoisted") && isDeclaredInLoop(
|
|
31958
|
-
this.reassign(
|
|
31957
|
+
if ((kind === "var" || kind === "hoisted") && isDeclaredInLoop(path2)) {
|
|
31958
|
+
this.reassign(path2);
|
|
31959
31959
|
}
|
|
31960
31960
|
this.clearValue();
|
|
31961
31961
|
}
|
|
@@ -31974,20 +31974,20 @@ var require_binding = __commonJS((exports) => {
|
|
|
31974
31974
|
this.hasValue = false;
|
|
31975
31975
|
this.value = null;
|
|
31976
31976
|
}
|
|
31977
|
-
reassign(
|
|
31977
|
+
reassign(path2) {
|
|
31978
31978
|
this.constant = false;
|
|
31979
|
-
if (this.constantViolations.indexOf(
|
|
31979
|
+
if (this.constantViolations.indexOf(path2) !== -1) {
|
|
31980
31980
|
return;
|
|
31981
31981
|
}
|
|
31982
|
-
this.constantViolations.push(
|
|
31982
|
+
this.constantViolations.push(path2);
|
|
31983
31983
|
}
|
|
31984
|
-
reference(
|
|
31985
|
-
if (this.referencePaths.indexOf(
|
|
31984
|
+
reference(path2) {
|
|
31985
|
+
if (this.referencePaths.indexOf(path2) !== -1) {
|
|
31986
31986
|
return;
|
|
31987
31987
|
}
|
|
31988
31988
|
this.referenced = true;
|
|
31989
31989
|
this.references++;
|
|
31990
|
-
this.referencePaths.push(
|
|
31990
|
+
this.referencePaths.push(path2);
|
|
31991
31991
|
}
|
|
31992
31992
|
dereference() {
|
|
31993
31993
|
this.references--;
|
|
@@ -33743,51 +33743,51 @@ var require_scope = __commonJS((exports) => {
|
|
|
33743
33743
|
buildUndefinedNode
|
|
33744
33744
|
} = _t;
|
|
33745
33745
|
var collectorVisitor = {
|
|
33746
|
-
ForStatement(
|
|
33747
|
-
const declar =
|
|
33746
|
+
ForStatement(path2) {
|
|
33747
|
+
const declar = path2.get("init");
|
|
33748
33748
|
if (declar.isVar()) {
|
|
33749
33749
|
const {
|
|
33750
33750
|
scope
|
|
33751
|
-
} =
|
|
33751
|
+
} = path2;
|
|
33752
33752
|
const parentScope = scope.getFunctionParent() || scope.getProgramParent();
|
|
33753
33753
|
parentScope.registerBinding("var", declar);
|
|
33754
33754
|
}
|
|
33755
33755
|
},
|
|
33756
|
-
Declaration(
|
|
33757
|
-
if (
|
|
33756
|
+
Declaration(path2) {
|
|
33757
|
+
if (path2.isBlockScoped())
|
|
33758
33758
|
return;
|
|
33759
|
-
if (
|
|
33759
|
+
if (path2.isImportDeclaration())
|
|
33760
33760
|
return;
|
|
33761
|
-
if (
|
|
33761
|
+
if (path2.isExportDeclaration())
|
|
33762
33762
|
return;
|
|
33763
|
-
const parent =
|
|
33764
|
-
parent.registerDeclaration(
|
|
33763
|
+
const parent = path2.scope.getFunctionParent() || path2.scope.getProgramParent();
|
|
33764
|
+
parent.registerDeclaration(path2);
|
|
33765
33765
|
},
|
|
33766
|
-
ImportDeclaration(
|
|
33767
|
-
const parent =
|
|
33768
|
-
parent.registerDeclaration(
|
|
33766
|
+
ImportDeclaration(path2) {
|
|
33767
|
+
const parent = path2.scope.getBlockParent();
|
|
33768
|
+
parent.registerDeclaration(path2);
|
|
33769
33769
|
},
|
|
33770
|
-
ReferencedIdentifier(
|
|
33771
|
-
state.references.push(
|
|
33770
|
+
ReferencedIdentifier(path2, state) {
|
|
33771
|
+
state.references.push(path2);
|
|
33772
33772
|
},
|
|
33773
|
-
ForXStatement(
|
|
33774
|
-
const left =
|
|
33773
|
+
ForXStatement(path2, state) {
|
|
33774
|
+
const left = path2.get("left");
|
|
33775
33775
|
if (left.isPattern() || left.isIdentifier()) {
|
|
33776
|
-
state.constantViolations.push(
|
|
33776
|
+
state.constantViolations.push(path2);
|
|
33777
33777
|
} else if (left.isVar()) {
|
|
33778
33778
|
const {
|
|
33779
33779
|
scope
|
|
33780
|
-
} =
|
|
33780
|
+
} = path2;
|
|
33781
33781
|
const parentScope = scope.getFunctionParent() || scope.getProgramParent();
|
|
33782
33782
|
parentScope.registerBinding("var", left);
|
|
33783
33783
|
}
|
|
33784
33784
|
},
|
|
33785
33785
|
ExportDeclaration: {
|
|
33786
|
-
exit(
|
|
33786
|
+
exit(path2) {
|
|
33787
33787
|
const {
|
|
33788
33788
|
node,
|
|
33789
33789
|
scope
|
|
33790
|
-
} =
|
|
33790
|
+
} = path2;
|
|
33791
33791
|
if (isExportAllDeclaration(node))
|
|
33792
33792
|
return;
|
|
33793
33793
|
const declar = node.declaration;
|
|
@@ -33796,65 +33796,65 @@ var require_scope = __commonJS((exports) => {
|
|
|
33796
33796
|
if (!id)
|
|
33797
33797
|
return;
|
|
33798
33798
|
const binding = scope.getBinding(id.name);
|
|
33799
|
-
binding == null || binding.reference(
|
|
33799
|
+
binding == null || binding.reference(path2);
|
|
33800
33800
|
} else if (isVariableDeclaration(declar)) {
|
|
33801
33801
|
for (const decl of declar.declarations) {
|
|
33802
33802
|
for (const name of Object.keys(getBindingIdentifiers(decl))) {
|
|
33803
33803
|
const binding = scope.getBinding(name);
|
|
33804
|
-
binding == null || binding.reference(
|
|
33804
|
+
binding == null || binding.reference(path2);
|
|
33805
33805
|
}
|
|
33806
33806
|
}
|
|
33807
33807
|
}
|
|
33808
33808
|
}
|
|
33809
33809
|
},
|
|
33810
|
-
LabeledStatement(
|
|
33811
|
-
|
|
33810
|
+
LabeledStatement(path2) {
|
|
33811
|
+
path2.scope.getBlockParent().registerDeclaration(path2);
|
|
33812
33812
|
},
|
|
33813
|
-
AssignmentExpression(
|
|
33814
|
-
state.assignments.push(
|
|
33813
|
+
AssignmentExpression(path2, state) {
|
|
33814
|
+
state.assignments.push(path2);
|
|
33815
33815
|
},
|
|
33816
|
-
UpdateExpression(
|
|
33817
|
-
state.constantViolations.push(
|
|
33816
|
+
UpdateExpression(path2, state) {
|
|
33817
|
+
state.constantViolations.push(path2);
|
|
33818
33818
|
},
|
|
33819
|
-
UnaryExpression(
|
|
33820
|
-
if (
|
|
33821
|
-
state.constantViolations.push(
|
|
33819
|
+
UnaryExpression(path2, state) {
|
|
33820
|
+
if (path2.node.operator === "delete") {
|
|
33821
|
+
state.constantViolations.push(path2);
|
|
33822
33822
|
}
|
|
33823
33823
|
},
|
|
33824
|
-
BlockScoped(
|
|
33825
|
-
let scope =
|
|
33826
|
-
if (scope.path ===
|
|
33824
|
+
BlockScoped(path2) {
|
|
33825
|
+
let scope = path2.scope;
|
|
33826
|
+
if (scope.path === path2)
|
|
33827
33827
|
scope = scope.parent;
|
|
33828
33828
|
const parent = scope.getBlockParent();
|
|
33829
|
-
parent.registerDeclaration(
|
|
33830
|
-
if (
|
|
33831
|
-
const id =
|
|
33829
|
+
parent.registerDeclaration(path2);
|
|
33830
|
+
if (path2.isClassDeclaration() && path2.node.id) {
|
|
33831
|
+
const id = path2.node.id;
|
|
33832
33832
|
const name = id.name;
|
|
33833
|
-
|
|
33833
|
+
path2.scope.bindings[name] = path2.scope.parent.getBinding(name);
|
|
33834
33834
|
}
|
|
33835
33835
|
},
|
|
33836
|
-
CatchClause(
|
|
33837
|
-
|
|
33836
|
+
CatchClause(path2) {
|
|
33837
|
+
path2.scope.registerBinding("let", path2);
|
|
33838
33838
|
},
|
|
33839
|
-
Function(
|
|
33840
|
-
const params =
|
|
33839
|
+
Function(path2) {
|
|
33840
|
+
const params = path2.get("params");
|
|
33841
33841
|
for (const param of params) {
|
|
33842
|
-
|
|
33842
|
+
path2.scope.registerBinding("param", param);
|
|
33843
33843
|
}
|
|
33844
|
-
if (
|
|
33845
|
-
|
|
33844
|
+
if (path2.isFunctionExpression() && path2.has("id") && !path2.get("id").node[NOT_LOCAL_BINDING]) {
|
|
33845
|
+
path2.scope.registerBinding("local", path2.get("id"), path2);
|
|
33846
33846
|
}
|
|
33847
33847
|
},
|
|
33848
|
-
ClassExpression(
|
|
33849
|
-
if (
|
|
33850
|
-
|
|
33848
|
+
ClassExpression(path2) {
|
|
33849
|
+
if (path2.has("id") && !path2.get("id").node[NOT_LOCAL_BINDING]) {
|
|
33850
|
+
path2.scope.registerBinding("local", path2);
|
|
33851
33851
|
}
|
|
33852
33852
|
}
|
|
33853
33853
|
};
|
|
33854
33854
|
var uid = 0;
|
|
33855
33855
|
|
|
33856
33856
|
class Scope {
|
|
33857
|
-
constructor(
|
|
33857
|
+
constructor(path2) {
|
|
33858
33858
|
this.uid = undefined;
|
|
33859
33859
|
this.path = undefined;
|
|
33860
33860
|
this.block = undefined;
|
|
@@ -33868,29 +33868,29 @@ var require_scope = __commonJS((exports) => {
|
|
|
33868
33868
|
this.crawling = undefined;
|
|
33869
33869
|
const {
|
|
33870
33870
|
node
|
|
33871
|
-
} =
|
|
33871
|
+
} = path2;
|
|
33872
33872
|
const cached = _cache.scope.get(node);
|
|
33873
|
-
if ((cached == null ? undefined : cached.path) ===
|
|
33873
|
+
if ((cached == null ? undefined : cached.path) === path2) {
|
|
33874
33874
|
return cached;
|
|
33875
33875
|
}
|
|
33876
33876
|
_cache.scope.set(node, this);
|
|
33877
33877
|
this.uid = uid++;
|
|
33878
33878
|
this.block = node;
|
|
33879
|
-
this.path =
|
|
33879
|
+
this.path = path2;
|
|
33880
33880
|
this.labels = new Map;
|
|
33881
33881
|
this.inited = false;
|
|
33882
33882
|
}
|
|
33883
33883
|
get parent() {
|
|
33884
33884
|
var _parent;
|
|
33885
|
-
let parent,
|
|
33885
|
+
let parent, path2 = this.path;
|
|
33886
33886
|
do {
|
|
33887
|
-
const shouldSkip =
|
|
33888
|
-
|
|
33889
|
-
if (shouldSkip &&
|
|
33890
|
-
|
|
33891
|
-
if (
|
|
33892
|
-
parent =
|
|
33893
|
-
} while (
|
|
33887
|
+
const shouldSkip = path2.key === "key" || path2.listKey === "decorators";
|
|
33888
|
+
path2 = path2.parentPath;
|
|
33889
|
+
if (shouldSkip && path2.isMethod())
|
|
33890
|
+
path2 = path2.parentPath;
|
|
33891
|
+
if (path2 && path2.isScope())
|
|
33892
|
+
parent = path2;
|
|
33893
|
+
} while (path2 && !parent);
|
|
33894
33894
|
return (_parent = parent) == null ? undefined : _parent.scope;
|
|
33895
33895
|
}
|
|
33896
33896
|
get parentBlock() {
|
|
@@ -34050,64 +34050,64 @@ var require_scope = __commonJS((exports) => {
|
|
|
34050
34050
|
getLabel(name) {
|
|
34051
34051
|
return this.labels.get(name);
|
|
34052
34052
|
}
|
|
34053
|
-
registerLabel(
|
|
34054
|
-
this.labels.set(
|
|
34053
|
+
registerLabel(path2) {
|
|
34054
|
+
this.labels.set(path2.node.label.name, path2);
|
|
34055
34055
|
}
|
|
34056
|
-
registerDeclaration(
|
|
34057
|
-
if (
|
|
34058
|
-
this.registerLabel(
|
|
34059
|
-
} else if (
|
|
34060
|
-
this.registerBinding("hoisted",
|
|
34061
|
-
} else if (
|
|
34062
|
-
const declarations =
|
|
34056
|
+
registerDeclaration(path2) {
|
|
34057
|
+
if (path2.isLabeledStatement()) {
|
|
34058
|
+
this.registerLabel(path2);
|
|
34059
|
+
} else if (path2.isFunctionDeclaration()) {
|
|
34060
|
+
this.registerBinding("hoisted", path2.get("id"), path2);
|
|
34061
|
+
} else if (path2.isVariableDeclaration()) {
|
|
34062
|
+
const declarations = path2.get("declarations");
|
|
34063
34063
|
const {
|
|
34064
34064
|
kind
|
|
34065
|
-
} =
|
|
34065
|
+
} = path2.node;
|
|
34066
34066
|
for (const declar of declarations) {
|
|
34067
34067
|
this.registerBinding(kind === "using" || kind === "await using" ? "const" : kind, declar);
|
|
34068
34068
|
}
|
|
34069
|
-
} else if (
|
|
34070
|
-
if (
|
|
34069
|
+
} else if (path2.isClassDeclaration()) {
|
|
34070
|
+
if (path2.node.declare)
|
|
34071
34071
|
return;
|
|
34072
|
-
this.registerBinding("let",
|
|
34073
|
-
} else if (
|
|
34074
|
-
const isTypeDeclaration =
|
|
34075
|
-
const specifiers =
|
|
34072
|
+
this.registerBinding("let", path2);
|
|
34073
|
+
} else if (path2.isImportDeclaration()) {
|
|
34074
|
+
const isTypeDeclaration = path2.node.importKind === "type" || path2.node.importKind === "typeof";
|
|
34075
|
+
const specifiers = path2.get("specifiers");
|
|
34076
34076
|
for (const specifier of specifiers) {
|
|
34077
34077
|
const isTypeSpecifier = isTypeDeclaration || specifier.isImportSpecifier() && (specifier.node.importKind === "type" || specifier.node.importKind === "typeof");
|
|
34078
34078
|
this.registerBinding(isTypeSpecifier ? "unknown" : "module", specifier);
|
|
34079
34079
|
}
|
|
34080
|
-
} else if (
|
|
34081
|
-
const declar =
|
|
34080
|
+
} else if (path2.isExportDeclaration()) {
|
|
34081
|
+
const declar = path2.get("declaration");
|
|
34082
34082
|
if (declar.isClassDeclaration() || declar.isFunctionDeclaration() || declar.isVariableDeclaration()) {
|
|
34083
34083
|
this.registerDeclaration(declar);
|
|
34084
34084
|
}
|
|
34085
34085
|
} else {
|
|
34086
|
-
this.registerBinding("unknown",
|
|
34086
|
+
this.registerBinding("unknown", path2);
|
|
34087
34087
|
}
|
|
34088
34088
|
}
|
|
34089
34089
|
buildUndefinedNode() {
|
|
34090
34090
|
return buildUndefinedNode();
|
|
34091
34091
|
}
|
|
34092
|
-
registerConstantViolation(
|
|
34093
|
-
const ids =
|
|
34092
|
+
registerConstantViolation(path2) {
|
|
34093
|
+
const ids = path2.getBindingIdentifiers();
|
|
34094
34094
|
for (const name of Object.keys(ids)) {
|
|
34095
34095
|
var _this$getBinding;
|
|
34096
|
-
(_this$getBinding = this.getBinding(name)) == null || _this$getBinding.reassign(
|
|
34096
|
+
(_this$getBinding = this.getBinding(name)) == null || _this$getBinding.reassign(path2);
|
|
34097
34097
|
}
|
|
34098
34098
|
}
|
|
34099
|
-
registerBinding(kind,
|
|
34099
|
+
registerBinding(kind, path2, bindingPath = path2) {
|
|
34100
34100
|
if (!kind)
|
|
34101
34101
|
throw new ReferenceError("no `kind`");
|
|
34102
|
-
if (
|
|
34103
|
-
const declarators =
|
|
34102
|
+
if (path2.isVariableDeclaration()) {
|
|
34103
|
+
const declarators = path2.get("declarations");
|
|
34104
34104
|
for (const declar of declarators) {
|
|
34105
34105
|
this.registerBinding(kind, declar);
|
|
34106
34106
|
}
|
|
34107
34107
|
return;
|
|
34108
34108
|
}
|
|
34109
34109
|
const parent = this.getProgramParent();
|
|
34110
|
-
const ids =
|
|
34110
|
+
const ids = path2.getOuterBindingIdentifiers(true);
|
|
34111
34111
|
for (const name of Object.keys(ids)) {
|
|
34112
34112
|
parent.references[name] = true;
|
|
34113
34113
|
for (const id of ids[name]) {
|
|
@@ -34262,7 +34262,7 @@ var require_scope = __commonJS((exports) => {
|
|
|
34262
34262
|
}
|
|
34263
34263
|
}
|
|
34264
34264
|
crawl() {
|
|
34265
|
-
const
|
|
34265
|
+
const path2 = this.path;
|
|
34266
34266
|
this.references = Object.create(null);
|
|
34267
34267
|
this.bindings = Object.create(null);
|
|
34268
34268
|
this.globals = Object.create(null);
|
|
@@ -34277,27 +34277,27 @@ var require_scope = __commonJS((exports) => {
|
|
|
34277
34277
|
assignments: []
|
|
34278
34278
|
};
|
|
34279
34279
|
this.crawling = true;
|
|
34280
|
-
if (
|
|
34280
|
+
if (path2.type !== "Program" && (0, _visitors.isExplodedVisitor)(collectorVisitor)) {
|
|
34281
34281
|
for (const visit of collectorVisitor.enter) {
|
|
34282
|
-
visit.call(state,
|
|
34282
|
+
visit.call(state, path2, state);
|
|
34283
34283
|
}
|
|
34284
|
-
const typeVisitors = collectorVisitor[
|
|
34284
|
+
const typeVisitors = collectorVisitor[path2.type];
|
|
34285
34285
|
if (typeVisitors) {
|
|
34286
34286
|
for (const visit of typeVisitors.enter) {
|
|
34287
|
-
visit.call(state,
|
|
34287
|
+
visit.call(state, path2, state);
|
|
34288
34288
|
}
|
|
34289
34289
|
}
|
|
34290
34290
|
}
|
|
34291
|
-
|
|
34291
|
+
path2.traverse(collectorVisitor, state);
|
|
34292
34292
|
this.crawling = false;
|
|
34293
|
-
for (const
|
|
34294
|
-
const ids =
|
|
34293
|
+
for (const path3 of state.assignments) {
|
|
34294
|
+
const ids = path3.getBindingIdentifiers();
|
|
34295
34295
|
for (const name of Object.keys(ids)) {
|
|
34296
|
-
if (
|
|
34296
|
+
if (path3.scope.getBinding(name))
|
|
34297
34297
|
continue;
|
|
34298
34298
|
programParent.addGlobal(ids[name]);
|
|
34299
34299
|
}
|
|
34300
|
-
|
|
34300
|
+
path3.scope.registerConstantViolation(path3);
|
|
34301
34301
|
}
|
|
34302
34302
|
for (const ref of state.references) {
|
|
34303
34303
|
const binding = ref.scope.getBinding(ref.node.name);
|
|
@@ -34307,19 +34307,19 @@ var require_scope = __commonJS((exports) => {
|
|
|
34307
34307
|
programParent.addGlobal(ref.node);
|
|
34308
34308
|
}
|
|
34309
34309
|
}
|
|
34310
|
-
for (const
|
|
34311
|
-
|
|
34310
|
+
for (const path3 of state.constantViolations) {
|
|
34311
|
+
path3.scope.registerConstantViolation(path3);
|
|
34312
34312
|
}
|
|
34313
34313
|
}
|
|
34314
34314
|
push(opts) {
|
|
34315
|
-
let
|
|
34316
|
-
if (
|
|
34317
|
-
|
|
34318
|
-
} else if (!
|
|
34319
|
-
|
|
34315
|
+
let path2 = this.path;
|
|
34316
|
+
if (path2.isPattern()) {
|
|
34317
|
+
path2 = this.getPatternParent().path;
|
|
34318
|
+
} else if (!path2.isBlockStatement() && !path2.isProgram()) {
|
|
34319
|
+
path2 = this.getBlockParent().path;
|
|
34320
34320
|
}
|
|
34321
|
-
if (
|
|
34322
|
-
|
|
34321
|
+
if (path2.isSwitchStatement()) {
|
|
34322
|
+
path2 = (this.getFunctionParent() || this.getProgramParent()).path;
|
|
34323
34323
|
}
|
|
34324
34324
|
const {
|
|
34325
34325
|
init: init2,
|
|
@@ -34327,30 +34327,30 @@ var require_scope = __commonJS((exports) => {
|
|
|
34327
34327
|
kind = "var",
|
|
34328
34328
|
id
|
|
34329
34329
|
} = opts;
|
|
34330
|
-
if (!init2 && !unique && (kind === "var" || kind === "let") &&
|
|
34331
|
-
callee:
|
|
34332
|
-
}) &&
|
|
34333
|
-
|
|
34334
|
-
|
|
34330
|
+
if (!init2 && !unique && (kind === "var" || kind === "let") && path2.isFunction() && !path2.node.name && isCallExpression(path2.parent, {
|
|
34331
|
+
callee: path2.node
|
|
34332
|
+
}) && path2.parent.arguments.length <= path2.node.params.length && isIdentifier(id)) {
|
|
34333
|
+
path2.pushContainer("params", id);
|
|
34334
|
+
path2.scope.registerBinding("param", path2.get("params")[path2.node.params.length - 1]);
|
|
34335
34335
|
return;
|
|
34336
34336
|
}
|
|
34337
|
-
if (
|
|
34338
|
-
|
|
34339
|
-
|
|
34337
|
+
if (path2.isLoop() || path2.isCatchClause() || path2.isFunction()) {
|
|
34338
|
+
path2.ensureBlock();
|
|
34339
|
+
path2 = path2.get("body");
|
|
34340
34340
|
}
|
|
34341
34341
|
const blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist;
|
|
34342
34342
|
const dataKey = `declaration:${kind}:${blockHoist}`;
|
|
34343
|
-
let declarPath = !unique &&
|
|
34343
|
+
let declarPath = !unique && path2.getData(dataKey);
|
|
34344
34344
|
if (!declarPath) {
|
|
34345
34345
|
const declar = variableDeclaration(kind, []);
|
|
34346
34346
|
declar._blockHoist = blockHoist;
|
|
34347
|
-
[declarPath] =
|
|
34347
|
+
[declarPath] = path2.unshiftContainer("body", [declar]);
|
|
34348
34348
|
if (!unique)
|
|
34349
|
-
|
|
34349
|
+
path2.setData(dataKey, declarPath);
|
|
34350
34350
|
}
|
|
34351
34351
|
const declarator = variableDeclarator(id, init2);
|
|
34352
34352
|
const len = declarPath.node.declarations.push(declarator);
|
|
34353
|
-
|
|
34353
|
+
path2.scope.registerBinding(kind, declarPath.get("declarations")[len - 1]);
|
|
34354
34354
|
}
|
|
34355
34355
|
getProgramParent() {
|
|
34356
34356
|
let scope = this;
|
|
@@ -34750,16 +34750,16 @@ var require_resolve_uri_umd = __commonJS((exports, module) => {
|
|
|
34750
34750
|
}
|
|
34751
34751
|
function parseFileUrl(input) {
|
|
34752
34752
|
const match = fileRegex.exec(input);
|
|
34753
|
-
const
|
|
34754
|
-
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(
|
|
34753
|
+
const path2 = match[2];
|
|
34754
|
+
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path2) ? path2 : "/" + path2, match[3] || "", match[4] || "");
|
|
34755
34755
|
}
|
|
34756
|
-
function makeUrl(scheme, user, host, port,
|
|
34756
|
+
function makeUrl(scheme, user, host, port, path2, query, hash) {
|
|
34757
34757
|
return {
|
|
34758
34758
|
scheme,
|
|
34759
34759
|
user,
|
|
34760
34760
|
host,
|
|
34761
34761
|
port,
|
|
34762
|
-
path:
|
|
34762
|
+
path: path2,
|
|
34763
34763
|
query,
|
|
34764
34764
|
hash,
|
|
34765
34765
|
type: 7
|
|
@@ -34789,11 +34789,11 @@ var require_resolve_uri_umd = __commonJS((exports, module) => {
|
|
|
34789
34789
|
url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
|
|
34790
34790
|
return url;
|
|
34791
34791
|
}
|
|
34792
|
-
function stripPathFilename(
|
|
34793
|
-
if (
|
|
34794
|
-
return
|
|
34795
|
-
const index =
|
|
34796
|
-
return
|
|
34792
|
+
function stripPathFilename(path2) {
|
|
34793
|
+
if (path2.endsWith("/.."))
|
|
34794
|
+
return path2;
|
|
34795
|
+
const index = path2.lastIndexOf("/");
|
|
34796
|
+
return path2.slice(0, index + 1);
|
|
34797
34797
|
}
|
|
34798
34798
|
function mergePaths(url, base) {
|
|
34799
34799
|
normalizePath(base, base.type);
|
|
@@ -34831,14 +34831,14 @@ var require_resolve_uri_umd = __commonJS((exports, module) => {
|
|
|
34831
34831
|
pieces[pointer++] = piece;
|
|
34832
34832
|
positive++;
|
|
34833
34833
|
}
|
|
34834
|
-
let
|
|
34834
|
+
let path2 = "";
|
|
34835
34835
|
for (let i = 1;i < pointer; i++) {
|
|
34836
|
-
|
|
34836
|
+
path2 += "/" + pieces[i];
|
|
34837
34837
|
}
|
|
34838
|
-
if (!
|
|
34839
|
-
|
|
34838
|
+
if (!path2 || addTrailingSlash && !path2.endsWith("/..")) {
|
|
34839
|
+
path2 += "/";
|
|
34840
34840
|
}
|
|
34841
|
-
url.path =
|
|
34841
|
+
url.path = path2;
|
|
34842
34842
|
}
|
|
34843
34843
|
function resolve(input, base) {
|
|
34844
34844
|
if (!input && !base)
|
|
@@ -34873,13 +34873,13 @@ var require_resolve_uri_umd = __commonJS((exports, module) => {
|
|
|
34873
34873
|
case 3:
|
|
34874
34874
|
return queryHash;
|
|
34875
34875
|
case 4: {
|
|
34876
|
-
const
|
|
34877
|
-
if (!
|
|
34876
|
+
const path2 = url.path.slice(1);
|
|
34877
|
+
if (!path2)
|
|
34878
34878
|
return queryHash || ".";
|
|
34879
|
-
if (isRelative(base || input) && !isRelative(
|
|
34880
|
-
return "./" +
|
|
34879
|
+
if (isRelative(base || input) && !isRelative(path2)) {
|
|
34880
|
+
return "./" + path2 + queryHash;
|
|
34881
34881
|
}
|
|
34882
|
-
return
|
|
34882
|
+
return path2 + queryHash;
|
|
34883
34883
|
}
|
|
34884
34884
|
case 5:
|
|
34885
34885
|
return url.path + queryHash;
|
|
@@ -34901,11 +34901,11 @@ var require_trace_mapping_umd = __commonJS((exports, module) => {
|
|
|
34901
34901
|
base += "/";
|
|
34902
34902
|
return resolveUri(input, base);
|
|
34903
34903
|
}
|
|
34904
|
-
function stripFilename(
|
|
34905
|
-
if (!
|
|
34904
|
+
function stripFilename(path2) {
|
|
34905
|
+
if (!path2)
|
|
34906
34906
|
return "";
|
|
34907
|
-
const index =
|
|
34908
|
-
return
|
|
34907
|
+
const index = path2.lastIndexOf("/");
|
|
34908
|
+
return path2.slice(0, index + 1);
|
|
34909
34909
|
}
|
|
34910
34910
|
const COLUMN = 0;
|
|
34911
34911
|
const SOURCES_INDEX = 1;
|
|
@@ -40724,58 +40724,58 @@ var require_lib7 = __commonJS((exports) => {
|
|
|
40724
40724
|
// ../../../../node_modules/@babel/traverse/lib/path/ancestry.js
|
|
40725
40725
|
var require_ancestry = __commonJS((exports) => {
|
|
40726
40726
|
var findParent = function(callback) {
|
|
40727
|
-
let
|
|
40728
|
-
while (
|
|
40729
|
-
if (callback(
|
|
40730
|
-
return
|
|
40727
|
+
let path2 = this;
|
|
40728
|
+
while (path2 = path2.parentPath) {
|
|
40729
|
+
if (callback(path2))
|
|
40730
|
+
return path2;
|
|
40731
40731
|
}
|
|
40732
40732
|
return null;
|
|
40733
40733
|
};
|
|
40734
40734
|
var find = function(callback) {
|
|
40735
|
-
let
|
|
40735
|
+
let path2 = this;
|
|
40736
40736
|
do {
|
|
40737
|
-
if (callback(
|
|
40738
|
-
return
|
|
40739
|
-
} while (
|
|
40737
|
+
if (callback(path2))
|
|
40738
|
+
return path2;
|
|
40739
|
+
} while (path2 = path2.parentPath);
|
|
40740
40740
|
return null;
|
|
40741
40741
|
};
|
|
40742
40742
|
var getFunctionParent = function() {
|
|
40743
40743
|
return this.findParent((p2) => p2.isFunction());
|
|
40744
40744
|
};
|
|
40745
40745
|
var getStatementParent = function() {
|
|
40746
|
-
let
|
|
40746
|
+
let path2 = this;
|
|
40747
40747
|
do {
|
|
40748
|
-
if (!
|
|
40748
|
+
if (!path2.parentPath || Array.isArray(path2.container) && path2.isStatement()) {
|
|
40749
40749
|
break;
|
|
40750
40750
|
} else {
|
|
40751
|
-
|
|
40751
|
+
path2 = path2.parentPath;
|
|
40752
40752
|
}
|
|
40753
|
-
} while (
|
|
40754
|
-
if (
|
|
40753
|
+
} while (path2);
|
|
40754
|
+
if (path2 && (path2.isProgram() || path2.isFile())) {
|
|
40755
40755
|
throw new Error("File/Program node, we can't possibly find a statement parent to this");
|
|
40756
40756
|
}
|
|
40757
|
-
return
|
|
40757
|
+
return path2;
|
|
40758
40758
|
};
|
|
40759
40759
|
var getEarliestCommonAncestorFrom = function(paths) {
|
|
40760
40760
|
return this.getDeepestCommonAncestorFrom(paths, function(deepest, i, ancestries) {
|
|
40761
40761
|
let earliest;
|
|
40762
40762
|
const keys = VISITOR_KEYS[deepest.type];
|
|
40763
40763
|
for (const ancestry of ancestries) {
|
|
40764
|
-
const
|
|
40764
|
+
const path2 = ancestry[i + 1];
|
|
40765
40765
|
if (!earliest) {
|
|
40766
|
-
earliest =
|
|
40766
|
+
earliest = path2;
|
|
40767
40767
|
continue;
|
|
40768
40768
|
}
|
|
40769
|
-
if (
|
|
40770
|
-
if (
|
|
40771
|
-
earliest =
|
|
40769
|
+
if (path2.listKey && earliest.listKey === path2.listKey) {
|
|
40770
|
+
if (path2.key < earliest.key) {
|
|
40771
|
+
earliest = path2;
|
|
40772
40772
|
continue;
|
|
40773
40773
|
}
|
|
40774
40774
|
}
|
|
40775
40775
|
const earliestKeyIndex = keys.indexOf(earliest.parentKey);
|
|
40776
|
-
const currentKeyIndex = keys.indexOf(
|
|
40776
|
+
const currentKeyIndex = keys.indexOf(path2.parentKey);
|
|
40777
40777
|
if (earliestKeyIndex > currentKeyIndex) {
|
|
40778
|
-
earliest =
|
|
40778
|
+
earliest = path2;
|
|
40779
40779
|
}
|
|
40780
40780
|
}
|
|
40781
40781
|
return earliest;
|
|
@@ -40790,11 +40790,11 @@ var require_ancestry = __commonJS((exports) => {
|
|
|
40790
40790
|
}
|
|
40791
40791
|
let minDepth = Infinity;
|
|
40792
40792
|
let lastCommonIndex, lastCommon;
|
|
40793
|
-
const ancestries = paths.map((
|
|
40793
|
+
const ancestries = paths.map((path2) => {
|
|
40794
40794
|
const ancestry = [];
|
|
40795
40795
|
do {
|
|
40796
|
-
ancestry.unshift(
|
|
40797
|
-
} while ((
|
|
40796
|
+
ancestry.unshift(path2);
|
|
40797
|
+
} while ((path2 = path2.parentPath) && path2 !== this);
|
|
40798
40798
|
if (ancestry.length < minDepth) {
|
|
40799
40799
|
minDepth = ancestry.length;
|
|
40800
40800
|
}
|
|
@@ -40823,11 +40823,11 @@ var require_ancestry = __commonJS((exports) => {
|
|
|
40823
40823
|
}
|
|
40824
40824
|
};
|
|
40825
40825
|
var getAncestry = function() {
|
|
40826
|
-
let
|
|
40826
|
+
let path2 = this;
|
|
40827
40827
|
const paths = [];
|
|
40828
40828
|
do {
|
|
40829
|
-
paths.push(
|
|
40830
|
-
} while (
|
|
40829
|
+
paths.push(path2);
|
|
40830
|
+
} while (path2 = path2.parentPath);
|
|
40831
40831
|
return paths;
|
|
40832
40832
|
};
|
|
40833
40833
|
var isAncestor = function(maybeDescendant) {
|
|
@@ -40837,13 +40837,13 @@ var require_ancestry = __commonJS((exports) => {
|
|
|
40837
40837
|
return !!this.findParent((parent) => parent === maybeAncestor);
|
|
40838
40838
|
};
|
|
40839
40839
|
var inType = function(...candidateTypes) {
|
|
40840
|
-
let
|
|
40841
|
-
while (
|
|
40840
|
+
let path2 = this;
|
|
40841
|
+
while (path2) {
|
|
40842
40842
|
for (const type of candidateTypes) {
|
|
40843
|
-
if (
|
|
40843
|
+
if (path2.node.type === type)
|
|
40844
40844
|
return true;
|
|
40845
40845
|
}
|
|
40846
|
-
|
|
40846
|
+
path2 = path2.parentPath;
|
|
40847
40847
|
}
|
|
40848
40848
|
return false;
|
|
40849
40849
|
};
|
|
@@ -40916,14 +40916,14 @@ var require_inferer_reference = __commonJS((exports) => {
|
|
|
40916
40916
|
} else if (node.name === "arguments") {
|
|
40917
40917
|
}
|
|
40918
40918
|
};
|
|
40919
|
-
var getTypeAnnotationBindingConstantViolations = function(binding,
|
|
40919
|
+
var getTypeAnnotationBindingConstantViolations = function(binding, path2, name) {
|
|
40920
40920
|
const types2 = [];
|
|
40921
40921
|
const functionConstantViolations = [];
|
|
40922
|
-
let constantViolations = getConstantViolationsBefore(binding,
|
|
40923
|
-
const testType = getConditionalAnnotation(binding,
|
|
40922
|
+
let constantViolations = getConstantViolationsBefore(binding, path2, functionConstantViolations);
|
|
40923
|
+
const testType = getConditionalAnnotation(binding, path2, name);
|
|
40924
40924
|
if (testType) {
|
|
40925
40925
|
const testConstantViolations = getConstantViolationsBefore(binding, testType.ifStatement);
|
|
40926
|
-
constantViolations = constantViolations.filter((
|
|
40926
|
+
constantViolations = constantViolations.filter((path3) => testConstantViolations.indexOf(path3) < 0);
|
|
40927
40927
|
types2.push(testType.typeAnnotation);
|
|
40928
40928
|
}
|
|
40929
40929
|
if (constantViolations.length) {
|
|
@@ -40937,21 +40937,21 @@ var require_inferer_reference = __commonJS((exports) => {
|
|
|
40937
40937
|
}
|
|
40938
40938
|
return (0, _util.createUnionType)(types2);
|
|
40939
40939
|
};
|
|
40940
|
-
var getConstantViolationsBefore = function(binding,
|
|
40940
|
+
var getConstantViolationsBefore = function(binding, path2, functions) {
|
|
40941
40941
|
const violations = binding.constantViolations.slice();
|
|
40942
40942
|
violations.unshift(binding.path);
|
|
40943
40943
|
return violations.filter((violation) => {
|
|
40944
40944
|
violation = violation.resolve();
|
|
40945
|
-
const status = violation._guessExecutionStatusRelativeTo(
|
|
40945
|
+
const status = violation._guessExecutionStatusRelativeTo(path2);
|
|
40946
40946
|
if (functions && status === "unknown")
|
|
40947
40947
|
functions.push(violation);
|
|
40948
40948
|
return status === "before";
|
|
40949
40949
|
});
|
|
40950
40950
|
};
|
|
40951
|
-
var inferAnnotationFromBinaryExpression = function(name,
|
|
40952
|
-
const operator =
|
|
40953
|
-
const right =
|
|
40954
|
-
const left =
|
|
40951
|
+
var inferAnnotationFromBinaryExpression = function(name, path2) {
|
|
40952
|
+
const operator = path2.node.operator;
|
|
40953
|
+
const right = path2.get("right").resolve();
|
|
40954
|
+
const left = path2.get("left").resolve();
|
|
40955
40955
|
let target;
|
|
40956
40956
|
if (left.isIdentifier({
|
|
40957
40957
|
name
|
|
@@ -41000,11 +41000,11 @@ var require_inferer_reference = __commonJS((exports) => {
|
|
|
41000
41000
|
return;
|
|
41001
41001
|
return createTypeAnnotationBasedOnTypeof(typeValue);
|
|
41002
41002
|
};
|
|
41003
|
-
var getParentConditionalPath = function(binding,
|
|
41003
|
+
var getParentConditionalPath = function(binding, path2, name) {
|
|
41004
41004
|
let parentPath;
|
|
41005
|
-
while (parentPath =
|
|
41005
|
+
while (parentPath = path2.parentPath) {
|
|
41006
41006
|
if (parentPath.isIfStatement() || parentPath.isConditionalExpression()) {
|
|
41007
|
-
if (
|
|
41007
|
+
if (path2.key === "test") {
|
|
41008
41008
|
return;
|
|
41009
41009
|
}
|
|
41010
41010
|
return parentPath;
|
|
@@ -41013,25 +41013,25 @@ var require_inferer_reference = __commonJS((exports) => {
|
|
|
41013
41013
|
if (parentPath.parentPath.scope.getBinding(name) !== binding)
|
|
41014
41014
|
return;
|
|
41015
41015
|
}
|
|
41016
|
-
|
|
41016
|
+
path2 = parentPath;
|
|
41017
41017
|
}
|
|
41018
41018
|
};
|
|
41019
|
-
var getConditionalAnnotation = function(binding,
|
|
41020
|
-
const ifStatement = getParentConditionalPath(binding,
|
|
41019
|
+
var getConditionalAnnotation = function(binding, path2, name) {
|
|
41020
|
+
const ifStatement = getParentConditionalPath(binding, path2, name);
|
|
41021
41021
|
if (!ifStatement)
|
|
41022
41022
|
return;
|
|
41023
41023
|
const test = ifStatement.get("test");
|
|
41024
41024
|
const paths = [test];
|
|
41025
41025
|
const types2 = [];
|
|
41026
41026
|
for (let i = 0;i < paths.length; i++) {
|
|
41027
|
-
const
|
|
41028
|
-
if (
|
|
41029
|
-
if (
|
|
41030
|
-
paths.push(
|
|
41031
|
-
paths.push(
|
|
41032
|
-
}
|
|
41033
|
-
} else if (
|
|
41034
|
-
const type = inferAnnotationFromBinaryExpression(name,
|
|
41027
|
+
const path3 = paths[i];
|
|
41028
|
+
if (path3.isLogicalExpression()) {
|
|
41029
|
+
if (path3.node.operator === "&&") {
|
|
41030
|
+
paths.push(path3.get("left"));
|
|
41031
|
+
paths.push(path3.get("right"));
|
|
41032
|
+
}
|
|
41033
|
+
} else if (path3.isBinaryExpression()) {
|
|
41034
|
+
const type = inferAnnotationFromBinaryExpression(name, path3);
|
|
41035
41035
|
if (type)
|
|
41036
41036
|
types2.push(type);
|
|
41037
41037
|
}
|
|
@@ -42580,15 +42580,15 @@ var require_route = __commonJS((exports, module) => {
|
|
|
42580
42580
|
};
|
|
42581
42581
|
};
|
|
42582
42582
|
var wrapConversion = function(toModel, graph) {
|
|
42583
|
-
var
|
|
42583
|
+
var path2 = [graph[toModel].parent, toModel];
|
|
42584
42584
|
var fn = conversions[graph[toModel].parent][toModel];
|
|
42585
42585
|
var cur = graph[toModel].parent;
|
|
42586
42586
|
while (graph[cur].parent) {
|
|
42587
|
-
|
|
42587
|
+
path2.unshift(graph[cur].parent);
|
|
42588
42588
|
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
42589
42589
|
cur = graph[cur].parent;
|
|
42590
42590
|
}
|
|
42591
|
-
fn.conversion =
|
|
42591
|
+
fn.conversion = path2;
|
|
42592
42592
|
return fn;
|
|
42593
42593
|
};
|
|
42594
42594
|
var conversions = require_conversions();
|
|
@@ -43545,8 +43545,8 @@ var require_lib10 = __commonJS((exports) => {
|
|
|
43545
43545
|
|
|
43546
43546
|
// ../../../../node_modules/@babel/helper-hoist-variables/lib/index.js
|
|
43547
43547
|
var require_lib11 = __commonJS((exports) => {
|
|
43548
|
-
var hoistVariables = function(
|
|
43549
|
-
|
|
43548
|
+
var hoistVariables = function(path2, emit, kind = "var") {
|
|
43549
|
+
path2.traverse(visitor, {
|
|
43550
43550
|
kind,
|
|
43551
43551
|
emit
|
|
43552
43552
|
});
|
|
@@ -43562,18 +43562,18 @@ var require_lib11 = __commonJS((exports) => {
|
|
|
43562
43562
|
identifier
|
|
43563
43563
|
} = _t;
|
|
43564
43564
|
var visitor = {
|
|
43565
|
-
Scope(
|
|
43565
|
+
Scope(path2, state) {
|
|
43566
43566
|
if (state.kind === "let")
|
|
43567
|
-
|
|
43567
|
+
path2.skip();
|
|
43568
43568
|
},
|
|
43569
|
-
FunctionParent(
|
|
43570
|
-
|
|
43569
|
+
FunctionParent(path2) {
|
|
43570
|
+
path2.skip();
|
|
43571
43571
|
},
|
|
43572
|
-
VariableDeclaration(
|
|
43573
|
-
if (state.kind &&
|
|
43572
|
+
VariableDeclaration(path2, state) {
|
|
43573
|
+
if (state.kind && path2.node.kind !== state.kind)
|
|
43574
43574
|
return;
|
|
43575
43575
|
const nodes = [];
|
|
43576
|
-
const declarations =
|
|
43576
|
+
const declarations = path2.get("declarations");
|
|
43577
43577
|
let firstId;
|
|
43578
43578
|
for (const declar of declarations) {
|
|
43579
43579
|
firstId = declar.node.id;
|
|
@@ -43584,12 +43584,12 @@ var require_lib11 = __commonJS((exports) => {
|
|
|
43584
43584
|
state.emit(identifier(name), name, declar.node.init !== null);
|
|
43585
43585
|
}
|
|
43586
43586
|
}
|
|
43587
|
-
if (
|
|
43588
|
-
left:
|
|
43587
|
+
if (path2.parentPath.isFor({
|
|
43588
|
+
left: path2.node
|
|
43589
43589
|
})) {
|
|
43590
|
-
|
|
43590
|
+
path2.replaceWith(firstId);
|
|
43591
43591
|
} else {
|
|
43592
|
-
|
|
43592
|
+
path2.replaceWithMultiple(nodes);
|
|
43593
43593
|
}
|
|
43594
43594
|
}
|
|
43595
43595
|
};
|
|
@@ -43717,10 +43717,10 @@ var require_replacement = __commonJS((exports) => {
|
|
|
43717
43717
|
});
|
|
43718
43718
|
}, "var");
|
|
43719
43719
|
const completionRecords = this.get("callee").getCompletionRecords();
|
|
43720
|
-
for (const
|
|
43721
|
-
if (!
|
|
43720
|
+
for (const path2 of completionRecords) {
|
|
43721
|
+
if (!path2.isExpressionStatement())
|
|
43722
43722
|
continue;
|
|
43723
|
-
const loop =
|
|
43723
|
+
const loop = path2.findParent((path3) => path3.isLoop());
|
|
43724
43724
|
if (loop) {
|
|
43725
43725
|
let uid = loop.getData("expressionReplacementReturnUid");
|
|
43726
43726
|
if (!uid) {
|
|
@@ -43730,9 +43730,9 @@ var require_replacement = __commonJS((exports) => {
|
|
|
43730
43730
|
} else {
|
|
43731
43731
|
uid = identifier(uid.name);
|
|
43732
43732
|
}
|
|
43733
|
-
|
|
43733
|
+
path2.get("expression").replaceWith(assignmentExpression("=", cloneNode(uid), path2.node.expression));
|
|
43734
43734
|
} else {
|
|
43735
|
-
|
|
43735
|
+
path2.replaceWith(returnStatement(path2.node.expression));
|
|
43736
43736
|
}
|
|
43737
43737
|
}
|
|
43738
43738
|
callee.arrowFunctionToExpression();
|
|
@@ -43881,16 +43881,16 @@ var require_evaluation = __commonJS((exports) => {
|
|
|
43881
43881
|
if (res.confident)
|
|
43882
43882
|
return !!res.value;
|
|
43883
43883
|
};
|
|
43884
|
-
var deopt = function(
|
|
43884
|
+
var deopt = function(path2, state) {
|
|
43885
43885
|
if (!state.confident)
|
|
43886
43886
|
return;
|
|
43887
|
-
state.deoptPath =
|
|
43887
|
+
state.deoptPath = path2;
|
|
43888
43888
|
state.confident = false;
|
|
43889
43889
|
};
|
|
43890
|
-
var evaluateCached = function(
|
|
43890
|
+
var evaluateCached = function(path2, state) {
|
|
43891
43891
|
const {
|
|
43892
43892
|
node
|
|
43893
|
-
} =
|
|
43893
|
+
} = path2;
|
|
43894
43894
|
const {
|
|
43895
43895
|
seen
|
|
43896
43896
|
} = state;
|
|
@@ -43899,7 +43899,7 @@ var require_evaluation = __commonJS((exports) => {
|
|
|
43899
43899
|
if (existing.resolved) {
|
|
43900
43900
|
return existing.value;
|
|
43901
43901
|
} else {
|
|
43902
|
-
deopt(
|
|
43902
|
+
deopt(path2, state);
|
|
43903
43903
|
return;
|
|
43904
43904
|
}
|
|
43905
43905
|
} else {
|
|
@@ -43907,7 +43907,7 @@ var require_evaluation = __commonJS((exports) => {
|
|
|
43907
43907
|
resolved: false
|
|
43908
43908
|
};
|
|
43909
43909
|
seen.set(node, item);
|
|
43910
|
-
const val = _evaluate(
|
|
43910
|
+
const val = _evaluate(path2, state);
|
|
43911
43911
|
if (state.confident) {
|
|
43912
43912
|
item.resolved = true;
|
|
43913
43913
|
item.value = val;
|
|
@@ -43915,57 +43915,57 @@ var require_evaluation = __commonJS((exports) => {
|
|
|
43915
43915
|
return val;
|
|
43916
43916
|
}
|
|
43917
43917
|
};
|
|
43918
|
-
var _evaluate = function(
|
|
43918
|
+
var _evaluate = function(path2, state) {
|
|
43919
43919
|
if (!state.confident)
|
|
43920
43920
|
return;
|
|
43921
|
-
if (
|
|
43922
|
-
const exprs =
|
|
43921
|
+
if (path2.isSequenceExpression()) {
|
|
43922
|
+
const exprs = path2.get("expressions");
|
|
43923
43923
|
return evaluateCached(exprs[exprs.length - 1], state);
|
|
43924
43924
|
}
|
|
43925
|
-
if (
|
|
43926
|
-
return
|
|
43925
|
+
if (path2.isStringLiteral() || path2.isNumericLiteral() || path2.isBooleanLiteral()) {
|
|
43926
|
+
return path2.node.value;
|
|
43927
43927
|
}
|
|
43928
|
-
if (
|
|
43928
|
+
if (path2.isNullLiteral()) {
|
|
43929
43929
|
return null;
|
|
43930
43930
|
}
|
|
43931
|
-
if (
|
|
43932
|
-
return evaluateQuasis(
|
|
43931
|
+
if (path2.isTemplateLiteral()) {
|
|
43932
|
+
return evaluateQuasis(path2, path2.node.quasis, state);
|
|
43933
43933
|
}
|
|
43934
|
-
if (
|
|
43935
|
-
const object =
|
|
43934
|
+
if (path2.isTaggedTemplateExpression() && path2.get("tag").isMemberExpression()) {
|
|
43935
|
+
const object = path2.get("tag.object");
|
|
43936
43936
|
const {
|
|
43937
43937
|
node: {
|
|
43938
43938
|
name
|
|
43939
43939
|
}
|
|
43940
43940
|
} = object;
|
|
43941
|
-
const property =
|
|
43942
|
-
if (object.isIdentifier() && name === "String" && !
|
|
43943
|
-
return evaluateQuasis(
|
|
43941
|
+
const property = path2.get("tag.property");
|
|
43942
|
+
if (object.isIdentifier() && name === "String" && !path2.scope.getBinding(name) && property.isIdentifier() && property.node.name === "raw") {
|
|
43943
|
+
return evaluateQuasis(path2, path2.node.quasi.quasis, state, true);
|
|
43944
43944
|
}
|
|
43945
43945
|
}
|
|
43946
|
-
if (
|
|
43947
|
-
const testResult = evaluateCached(
|
|
43946
|
+
if (path2.isConditionalExpression()) {
|
|
43947
|
+
const testResult = evaluateCached(path2.get("test"), state);
|
|
43948
43948
|
if (!state.confident)
|
|
43949
43949
|
return;
|
|
43950
43950
|
if (testResult) {
|
|
43951
|
-
return evaluateCached(
|
|
43951
|
+
return evaluateCached(path2.get("consequent"), state);
|
|
43952
43952
|
} else {
|
|
43953
|
-
return evaluateCached(
|
|
43953
|
+
return evaluateCached(path2.get("alternate"), state);
|
|
43954
43954
|
}
|
|
43955
43955
|
}
|
|
43956
|
-
if (
|
|
43957
|
-
return evaluateCached(
|
|
43956
|
+
if (path2.isExpressionWrapper()) {
|
|
43957
|
+
return evaluateCached(path2.get("expression"), state);
|
|
43958
43958
|
}
|
|
43959
|
-
if (
|
|
43960
|
-
callee:
|
|
43959
|
+
if (path2.isMemberExpression() && !path2.parentPath.isCallExpression({
|
|
43960
|
+
callee: path2.node
|
|
43961
43961
|
})) {
|
|
43962
|
-
const property =
|
|
43963
|
-
const object =
|
|
43962
|
+
const property = path2.get("property");
|
|
43963
|
+
const object = path2.get("object");
|
|
43964
43964
|
if (object.isLiteral()) {
|
|
43965
43965
|
const value = object.node.value;
|
|
43966
43966
|
const type = typeof value;
|
|
43967
43967
|
let key = null;
|
|
43968
|
-
if (
|
|
43968
|
+
if (path2.node.computed) {
|
|
43969
43969
|
key = evaluateCached(property, state);
|
|
43970
43970
|
if (!state.confident)
|
|
43971
43971
|
return;
|
|
@@ -43977,10 +43977,10 @@ var require_evaluation = __commonJS((exports) => {
|
|
|
43977
43977
|
}
|
|
43978
43978
|
}
|
|
43979
43979
|
}
|
|
43980
|
-
if (
|
|
43981
|
-
const binding =
|
|
43980
|
+
if (path2.isReferencedIdentifier()) {
|
|
43981
|
+
const binding = path2.scope.getBinding(path2.node.name);
|
|
43982
43982
|
if (binding) {
|
|
43983
|
-
if (binding.constantViolations.length > 0 ||
|
|
43983
|
+
if (binding.constantViolations.length > 0 || path2.node.start < binding.path.node.end) {
|
|
43984
43984
|
deopt(binding.path, state);
|
|
43985
43985
|
return;
|
|
43986
43986
|
}
|
|
@@ -43988,7 +43988,7 @@ var require_evaluation = __commonJS((exports) => {
|
|
|
43988
43988
|
return binding.value;
|
|
43989
43989
|
}
|
|
43990
43990
|
}
|
|
43991
|
-
const name =
|
|
43991
|
+
const name = path2.node.name;
|
|
43992
43992
|
if (Globals.has(name)) {
|
|
43993
43993
|
if (!binding) {
|
|
43994
43994
|
return Globals.get(name);
|
|
@@ -43996,28 +43996,28 @@ var require_evaluation = __commonJS((exports) => {
|
|
|
43996
43996
|
deopt(binding.path, state);
|
|
43997
43997
|
return;
|
|
43998
43998
|
}
|
|
43999
|
-
const resolved =
|
|
44000
|
-
if (resolved ===
|
|
44001
|
-
deopt(
|
|
43999
|
+
const resolved = path2.resolve();
|
|
44000
|
+
if (resolved === path2) {
|
|
44001
|
+
deopt(path2, state);
|
|
44002
44002
|
return;
|
|
44003
44003
|
} else {
|
|
44004
44004
|
return evaluateCached(resolved, state);
|
|
44005
44005
|
}
|
|
44006
44006
|
}
|
|
44007
|
-
if (
|
|
44007
|
+
if (path2.isUnaryExpression({
|
|
44008
44008
|
prefix: true
|
|
44009
44009
|
})) {
|
|
44010
|
-
if (
|
|
44010
|
+
if (path2.node.operator === "void") {
|
|
44011
44011
|
return;
|
|
44012
44012
|
}
|
|
44013
|
-
const argument =
|
|
44014
|
-
if (
|
|
44013
|
+
const argument = path2.get("argument");
|
|
44014
|
+
if (path2.node.operator === "typeof" && (argument.isFunction() || argument.isClass())) {
|
|
44015
44015
|
return "function";
|
|
44016
44016
|
}
|
|
44017
44017
|
const arg = evaluateCached(argument, state);
|
|
44018
44018
|
if (!state.confident)
|
|
44019
44019
|
return;
|
|
44020
|
-
switch (
|
|
44020
|
+
switch (path2.node.operator) {
|
|
44021
44021
|
case "!":
|
|
44022
44022
|
return !arg;
|
|
44023
44023
|
case "+":
|
|
@@ -44030,9 +44030,9 @@ var require_evaluation = __commonJS((exports) => {
|
|
|
44030
44030
|
return typeof arg;
|
|
44031
44031
|
}
|
|
44032
44032
|
}
|
|
44033
|
-
if (
|
|
44033
|
+
if (path2.isArrayExpression()) {
|
|
44034
44034
|
const arr = [];
|
|
44035
|
-
const elems =
|
|
44035
|
+
const elems = path2.get("elements");
|
|
44036
44036
|
for (const elem of elems) {
|
|
44037
44037
|
const elemValue = elem.evaluate();
|
|
44038
44038
|
if (elemValue.confident) {
|
|
@@ -44044,9 +44044,9 @@ var require_evaluation = __commonJS((exports) => {
|
|
|
44044
44044
|
}
|
|
44045
44045
|
return arr;
|
|
44046
44046
|
}
|
|
44047
|
-
if (
|
|
44047
|
+
if (path2.isObjectExpression()) {
|
|
44048
44048
|
const obj = {};
|
|
44049
|
-
const props =
|
|
44049
|
+
const props = path2.get("properties");
|
|
44050
44050
|
for (const prop of props) {
|
|
44051
44051
|
if (prop.isObjectMethod() || prop.isSpreadElement()) {
|
|
44052
44052
|
deopt(prop, state);
|
|
@@ -44077,14 +44077,14 @@ var require_evaluation = __commonJS((exports) => {
|
|
|
44077
44077
|
}
|
|
44078
44078
|
return obj;
|
|
44079
44079
|
}
|
|
44080
|
-
if (
|
|
44080
|
+
if (path2.isLogicalExpression()) {
|
|
44081
44081
|
const wasConfident = state.confident;
|
|
44082
|
-
const left = evaluateCached(
|
|
44082
|
+
const left = evaluateCached(path2.get("left"), state);
|
|
44083
44083
|
const leftConfident = state.confident;
|
|
44084
44084
|
state.confident = wasConfident;
|
|
44085
|
-
const right = evaluateCached(
|
|
44085
|
+
const right = evaluateCached(path2.get("right"), state);
|
|
44086
44086
|
const rightConfident = state.confident;
|
|
44087
|
-
switch (
|
|
44087
|
+
switch (path2.node.operator) {
|
|
44088
44088
|
case "||":
|
|
44089
44089
|
state.confident = leftConfident && (!!left || rightConfident);
|
|
44090
44090
|
if (!state.confident)
|
|
@@ -44102,14 +44102,14 @@ var require_evaluation = __commonJS((exports) => {
|
|
|
44102
44102
|
return left != null ? left : right;
|
|
44103
44103
|
}
|
|
44104
44104
|
}
|
|
44105
|
-
if (
|
|
44106
|
-
const left = evaluateCached(
|
|
44105
|
+
if (path2.isBinaryExpression()) {
|
|
44106
|
+
const left = evaluateCached(path2.get("left"), state);
|
|
44107
44107
|
if (!state.confident)
|
|
44108
44108
|
return;
|
|
44109
|
-
const right = evaluateCached(
|
|
44109
|
+
const right = evaluateCached(path2.get("right"), state);
|
|
44110
44110
|
if (!state.confident)
|
|
44111
44111
|
return;
|
|
44112
|
-
switch (
|
|
44112
|
+
switch (path2.node.operator) {
|
|
44113
44113
|
case "-":
|
|
44114
44114
|
return left - right;
|
|
44115
44115
|
case "+":
|
|
@@ -44152,11 +44152,11 @@ var require_evaluation = __commonJS((exports) => {
|
|
|
44152
44152
|
return left >>> right;
|
|
44153
44153
|
}
|
|
44154
44154
|
}
|
|
44155
|
-
if (
|
|
44156
|
-
const callee =
|
|
44155
|
+
if (path2.isCallExpression()) {
|
|
44156
|
+
const callee = path2.get("callee");
|
|
44157
44157
|
let context;
|
|
44158
44158
|
let func;
|
|
44159
|
-
if (callee.isIdentifier() && !
|
|
44159
|
+
if (callee.isIdentifier() && !path2.scope.getBinding(callee.node.name) && (isValidObjectCallee(callee.node.name) || isValidIdentifierCallee(callee.node.name))) {
|
|
44160
44160
|
func = global[callee.node.name];
|
|
44161
44161
|
}
|
|
44162
44162
|
if (callee.isMemberExpression()) {
|
|
@@ -44178,18 +44178,18 @@ var require_evaluation = __commonJS((exports) => {
|
|
|
44178
44178
|
}
|
|
44179
44179
|
}
|
|
44180
44180
|
if (func) {
|
|
44181
|
-
const args =
|
|
44181
|
+
const args = path2.get("arguments").map((arg) => evaluateCached(arg, state));
|
|
44182
44182
|
if (!state.confident)
|
|
44183
44183
|
return;
|
|
44184
44184
|
return func.apply(context, args);
|
|
44185
44185
|
}
|
|
44186
44186
|
}
|
|
44187
|
-
deopt(
|
|
44187
|
+
deopt(path2, state);
|
|
44188
44188
|
};
|
|
44189
|
-
var evaluateQuasis = function(
|
|
44189
|
+
var evaluateQuasis = function(path2, quasis, state, raw = false) {
|
|
44190
44190
|
let str = "";
|
|
44191
44191
|
let i = 0;
|
|
44192
|
-
const exprs =
|
|
44192
|
+
const exprs = path2.isTemplateLiteral() ? path2.get("expressions") : path2.get("quasi.expressions");
|
|
44193
44193
|
for (const elem of quasis) {
|
|
44194
44194
|
if (!state.confident)
|
|
44195
44195
|
break;
|
|
@@ -45006,14 +45006,14 @@ var require_lib13 = __commonJS((exports) => {
|
|
|
45006
45006
|
})(FUNCTION)
|
|
45007
45007
|
`);
|
|
45008
45008
|
var visitor = {
|
|
45009
|
-
"ReferencedIdentifier|BindingIdentifier"(
|
|
45010
|
-
if (
|
|
45009
|
+
"ReferencedIdentifier|BindingIdentifier"(path2, state) {
|
|
45010
|
+
if (path2.node.name !== state.name)
|
|
45011
45011
|
return;
|
|
45012
|
-
const localDeclar =
|
|
45012
|
+
const localDeclar = path2.scope.getBindingIdentifier(state.name);
|
|
45013
45013
|
if (localDeclar !== state.outerDeclar)
|
|
45014
45014
|
return;
|
|
45015
45015
|
state.selfReference = true;
|
|
45016
|
-
|
|
45016
|
+
path2.stop();
|
|
45017
45017
|
}
|
|
45018
45018
|
};
|
|
45019
45019
|
});
|
|
@@ -45076,8 +45076,8 @@ var require_conversion = __commonJS((exports) => {
|
|
|
45076
45076
|
}
|
|
45077
45077
|
hoistFunctionEnvironment(this);
|
|
45078
45078
|
};
|
|
45079
|
-
var setType = function(
|
|
45080
|
-
|
|
45079
|
+
var setType = function(path2, type) {
|
|
45080
|
+
path2.node.type = type;
|
|
45081
45081
|
};
|
|
45082
45082
|
var arrowFunctionToExpression = function({
|
|
45083
45083
|
allowInsertArrow = true,
|
|
@@ -45539,21 +45539,21 @@ var require_introspection = __commonJS((exports) => {
|
|
|
45539
45539
|
return false;
|
|
45540
45540
|
};
|
|
45541
45541
|
var isCompletionRecord = function(allowInsideFunction) {
|
|
45542
|
-
let
|
|
45542
|
+
let path2 = this;
|
|
45543
45543
|
let first = true;
|
|
45544
45544
|
do {
|
|
45545
45545
|
const {
|
|
45546
45546
|
type,
|
|
45547
45547
|
container
|
|
45548
|
-
} =
|
|
45549
|
-
if (!first && (
|
|
45548
|
+
} = path2;
|
|
45549
|
+
if (!first && (path2.isFunction() || type === "StaticBlock")) {
|
|
45550
45550
|
return !!allowInsideFunction;
|
|
45551
45551
|
}
|
|
45552
45552
|
first = false;
|
|
45553
|
-
if (Array.isArray(container) &&
|
|
45553
|
+
if (Array.isArray(container) && path2.key !== container.length - 1) {
|
|
45554
45554
|
return false;
|
|
45555
45555
|
}
|
|
45556
|
-
} while ((
|
|
45556
|
+
} while ((path2 = path2.parentPath) && !path2.isProgram() && !path2.isDoExpression());
|
|
45557
45557
|
return true;
|
|
45558
45558
|
};
|
|
45559
45559
|
var isStatementOrBlock = function() {
|
|
@@ -45576,8 +45576,8 @@ var require_introspection = __commonJS((exports) => {
|
|
|
45576
45576
|
const binding = this.scope.getBinding(this.node.name);
|
|
45577
45577
|
if (!binding || binding.kind !== "module")
|
|
45578
45578
|
return false;
|
|
45579
|
-
const
|
|
45580
|
-
const parent =
|
|
45579
|
+
const path2 = binding.path;
|
|
45580
|
+
const parent = path2.parentPath;
|
|
45581
45581
|
if (!parent.isImportDeclaration())
|
|
45582
45582
|
return false;
|
|
45583
45583
|
if (parent.node.source.value === moduleSource) {
|
|
@@ -45586,13 +45586,13 @@ var require_introspection = __commonJS((exports) => {
|
|
|
45586
45586
|
} else {
|
|
45587
45587
|
return false;
|
|
45588
45588
|
}
|
|
45589
|
-
if (
|
|
45589
|
+
if (path2.isImportDefaultSpecifier() && importName === "default") {
|
|
45590
45590
|
return true;
|
|
45591
45591
|
}
|
|
45592
|
-
if (
|
|
45592
|
+
if (path2.isImportNamespaceSpecifier() && importName === "*") {
|
|
45593
45593
|
return true;
|
|
45594
45594
|
}
|
|
45595
|
-
if (
|
|
45595
|
+
if (path2.isImportSpecifier() && isIdentifier(path2.node.imported, {
|
|
45596
45596
|
name: importName
|
|
45597
45597
|
})) {
|
|
45598
45598
|
return true;
|
|
@@ -45611,8 +45611,8 @@ var require_introspection = __commonJS((exports) => {
|
|
|
45611
45611
|
var willIMaybeExecuteBefore = function(target) {
|
|
45612
45612
|
return this._guessExecutionStatusRelativeTo(target) !== "after";
|
|
45613
45613
|
};
|
|
45614
|
-
var getOuterFunction = function(
|
|
45615
|
-
return
|
|
45614
|
+
var getOuterFunction = function(path2) {
|
|
45615
|
+
return path2.isProgram() ? path2 : (path2.parentPath.scope.getFunctionParent() || path2.parentPath.scope.getProgramParent()).path;
|
|
45616
45616
|
};
|
|
45617
45617
|
var isExecutionUncertain = function(type, key) {
|
|
45618
45618
|
switch (type) {
|
|
@@ -45644,8 +45644,8 @@ var require_introspection = __commonJS((exports) => {
|
|
|
45644
45644
|
};
|
|
45645
45645
|
var isExecutionUncertainInList = function(paths, maxIndex) {
|
|
45646
45646
|
for (let i = 0;i < maxIndex; i++) {
|
|
45647
|
-
const
|
|
45648
|
-
if (isExecutionUncertain(
|
|
45647
|
+
const path2 = paths[i];
|
|
45648
|
+
if (isExecutionUncertain(path2.parent.type, path2.parentKey)) {
|
|
45649
45649
|
return true;
|
|
45650
45650
|
}
|
|
45651
45651
|
}
|
|
@@ -45676,10 +45676,10 @@ var require_introspection = __commonJS((exports) => {
|
|
|
45676
45676
|
this: 0
|
|
45677
45677
|
};
|
|
45678
45678
|
while (!commonPath && commonIndex.this < paths.this.length) {
|
|
45679
|
-
const
|
|
45680
|
-
commonIndex.target = paths.target.indexOf(
|
|
45679
|
+
const path2 = paths.this[commonIndex.this];
|
|
45680
|
+
commonIndex.target = paths.target.indexOf(path2);
|
|
45681
45681
|
if (commonIndex.target >= 0) {
|
|
45682
|
-
commonPath =
|
|
45682
|
+
commonPath = path2;
|
|
45683
45683
|
} else {
|
|
45684
45684
|
commonIndex.this++;
|
|
45685
45685
|
}
|
|
@@ -45718,14 +45718,14 @@ var require_introspection = __commonJS((exports) => {
|
|
|
45718
45718
|
return "before";
|
|
45719
45719
|
const referencePaths = binding.referencePaths;
|
|
45720
45720
|
let allStatus;
|
|
45721
|
-
for (const
|
|
45722
|
-
const childOfFunction = !!
|
|
45721
|
+
for (const path2 of referencePaths) {
|
|
45722
|
+
const childOfFunction = !!path2.find((path3) => path3.node === target.node);
|
|
45723
45723
|
if (childOfFunction)
|
|
45724
45724
|
continue;
|
|
45725
|
-
if (
|
|
45725
|
+
if (path2.key !== "callee" || !path2.parentPath.isCallExpression()) {
|
|
45726
45726
|
return "unknown";
|
|
45727
45727
|
}
|
|
45728
|
-
const status = _guessExecutionStatusRelativeToCached(base,
|
|
45728
|
+
const status = _guessExecutionStatusRelativeToCached(base, path2, cache2);
|
|
45729
45729
|
if (allStatus && allStatus !== status) {
|
|
45730
45730
|
return "unknown";
|
|
45731
45731
|
} else {
|
|
@@ -45852,21 +45852,21 @@ var require_introspection = __commonJS((exports) => {
|
|
|
45852
45852
|
};
|
|
45853
45853
|
var isInStrictMode = function() {
|
|
45854
45854
|
const start = this.isProgram() ? this : this.parentPath;
|
|
45855
|
-
const strictParent = start.find((
|
|
45856
|
-
if (
|
|
45855
|
+
const strictParent = start.find((path2) => {
|
|
45856
|
+
if (path2.isProgram({
|
|
45857
45857
|
sourceType: "module"
|
|
45858
45858
|
}))
|
|
45859
45859
|
return true;
|
|
45860
|
-
if (
|
|
45860
|
+
if (path2.isClass())
|
|
45861
45861
|
return true;
|
|
45862
|
-
if (
|
|
45862
|
+
if (path2.isArrowFunctionExpression() && !path2.get("body").isBlockStatement()) {
|
|
45863
45863
|
return false;
|
|
45864
45864
|
}
|
|
45865
45865
|
let body;
|
|
45866
|
-
if (
|
|
45867
|
-
body =
|
|
45868
|
-
} else if (
|
|
45869
|
-
body =
|
|
45866
|
+
if (path2.isFunction()) {
|
|
45867
|
+
body = path2.node.body;
|
|
45868
|
+
} else if (path2.isProgram()) {
|
|
45869
|
+
body = path2.node;
|
|
45870
45870
|
} else {
|
|
45871
45871
|
return false;
|
|
45872
45872
|
}
|
|
@@ -45959,11 +45959,11 @@ var require_context = __commonJS((exports) => {
|
|
|
45959
45959
|
const denylist = (_this$opts$denylist = this.opts.denylist) != null ? _this$opts$denylist : this.opts.blacklist;
|
|
45960
45960
|
return denylist && denylist.indexOf(this.node.type) > -1;
|
|
45961
45961
|
};
|
|
45962
|
-
var restoreContext = function(
|
|
45963
|
-
if (
|
|
45964
|
-
|
|
45965
|
-
|
|
45966
|
-
|
|
45962
|
+
var restoreContext = function(path2, context) {
|
|
45963
|
+
if (path2.context !== context) {
|
|
45964
|
+
path2.context = context;
|
|
45965
|
+
path2.state = context.state;
|
|
45966
|
+
path2.opts = context.opts;
|
|
45967
45967
|
}
|
|
45968
45968
|
};
|
|
45969
45969
|
var visit = function() {
|
|
@@ -46005,17 +46005,17 @@ var require_context = __commonJS((exports) => {
|
|
|
46005
46005
|
var _this$opts2, _this$scope;
|
|
46006
46006
|
if ((_this$opts2 = this.opts) != null && _this$opts2.noScope)
|
|
46007
46007
|
return;
|
|
46008
|
-
let
|
|
46009
|
-
if ((this.key === "key" || this.listKey === "decorators") &&
|
|
46010
|
-
|
|
46008
|
+
let path2 = this.parentPath;
|
|
46009
|
+
if ((this.key === "key" || this.listKey === "decorators") && path2.isMethod() || this.key === "discriminant" && path2.isSwitchStatement()) {
|
|
46010
|
+
path2 = path2.parentPath;
|
|
46011
46011
|
}
|
|
46012
46012
|
let target;
|
|
46013
|
-
while (
|
|
46013
|
+
while (path2 && !target) {
|
|
46014
46014
|
var _path$opts;
|
|
46015
|
-
if ((_path$opts =
|
|
46015
|
+
if ((_path$opts = path2.opts) != null && _path$opts.noScope)
|
|
46016
46016
|
return;
|
|
46017
|
-
target =
|
|
46018
|
-
|
|
46017
|
+
target = path2.scope;
|
|
46018
|
+
path2 = path2.parentPath;
|
|
46019
46019
|
}
|
|
46020
46020
|
this.scope = this.getScope(target);
|
|
46021
46021
|
(_this$scope = this.scope) == null || _this$scope.init();
|
|
@@ -46114,13 +46114,13 @@ var require_context = __commonJS((exports) => {
|
|
|
46114
46114
|
}
|
|
46115
46115
|
};
|
|
46116
46116
|
var _getQueueContexts = function() {
|
|
46117
|
-
let
|
|
46117
|
+
let path2 = this;
|
|
46118
46118
|
let contexts = this.contexts;
|
|
46119
46119
|
while (!contexts.length) {
|
|
46120
|
-
|
|
46121
|
-
if (!
|
|
46120
|
+
path2 = path2.parentPath;
|
|
46121
|
+
if (!path2)
|
|
46122
46122
|
break;
|
|
46123
|
-
contexts =
|
|
46123
|
+
contexts = path2.contexts;
|
|
46124
46124
|
}
|
|
46125
46125
|
return contexts;
|
|
46126
46126
|
};
|
|
@@ -46273,12 +46273,12 @@ var require_hoister = __commonJS((exports) => {
|
|
|
46273
46273
|
variableDeclarator
|
|
46274
46274
|
} = _t2;
|
|
46275
46275
|
var referenceVisitor = {
|
|
46276
|
-
ReferencedIdentifier(
|
|
46277
|
-
if (
|
|
46276
|
+
ReferencedIdentifier(path2, state) {
|
|
46277
|
+
if (path2.isJSXIdentifier() && react.isCompatTag(path2.node.name) && !path2.parentPath.isJSXMemberExpression()) {
|
|
46278
46278
|
return;
|
|
46279
46279
|
}
|
|
46280
|
-
if (
|
|
46281
|
-
let scope =
|
|
46280
|
+
if (path2.node.name === "this") {
|
|
46281
|
+
let scope = path2.scope;
|
|
46282
46282
|
do {
|
|
46283
46283
|
if (scope.path.isFunction() && !scope.path.isArrowFunctionExpression()) {
|
|
46284
46284
|
break;
|
|
@@ -46287,24 +46287,24 @@ var require_hoister = __commonJS((exports) => {
|
|
|
46287
46287
|
if (scope)
|
|
46288
46288
|
state.breakOnScopePaths.push(scope.path);
|
|
46289
46289
|
}
|
|
46290
|
-
const binding =
|
|
46290
|
+
const binding = path2.scope.getBinding(path2.node.name);
|
|
46291
46291
|
if (!binding)
|
|
46292
46292
|
return;
|
|
46293
46293
|
for (const violation of binding.constantViolations) {
|
|
46294
46294
|
if (violation.scope !== binding.path.scope) {
|
|
46295
46295
|
state.mutableBinding = true;
|
|
46296
|
-
|
|
46296
|
+
path2.stop();
|
|
46297
46297
|
return;
|
|
46298
46298
|
}
|
|
46299
46299
|
}
|
|
46300
|
-
if (binding !== state.scope.getBinding(
|
|
46300
|
+
if (binding !== state.scope.getBinding(path2.node.name))
|
|
46301
46301
|
return;
|
|
46302
|
-
state.bindings[
|
|
46302
|
+
state.bindings[path2.node.name] = binding;
|
|
46303
46303
|
}
|
|
46304
46304
|
};
|
|
46305
46305
|
|
|
46306
46306
|
class PathHoister {
|
|
46307
|
-
constructor(
|
|
46307
|
+
constructor(path2, scope) {
|
|
46308
46308
|
this.breakOnScopePaths = undefined;
|
|
46309
46309
|
this.bindings = undefined;
|
|
46310
46310
|
this.mutableBinding = undefined;
|
|
@@ -46317,7 +46317,7 @@ var require_hoister = __commonJS((exports) => {
|
|
|
46317
46317
|
this.mutableBinding = false;
|
|
46318
46318
|
this.scopes = [];
|
|
46319
46319
|
this.scope = scope;
|
|
46320
|
-
this.path =
|
|
46320
|
+
this.path = path2;
|
|
46321
46321
|
this.attachAfter = false;
|
|
46322
46322
|
}
|
|
46323
46323
|
isCompatibleScope(scope) {
|
|
@@ -46343,12 +46343,12 @@ var require_hoister = __commonJS((exports) => {
|
|
|
46343
46343
|
} while (scope = scope.parent);
|
|
46344
46344
|
}
|
|
46345
46345
|
getAttachmentPath() {
|
|
46346
|
-
let
|
|
46347
|
-
if (!
|
|
46346
|
+
let path2 = this._getAttachmentPath();
|
|
46347
|
+
if (!path2)
|
|
46348
46348
|
return;
|
|
46349
|
-
let targetScope =
|
|
46350
|
-
if (targetScope.path ===
|
|
46351
|
-
targetScope =
|
|
46349
|
+
let targetScope = path2.scope;
|
|
46350
|
+
if (targetScope.path === path2) {
|
|
46351
|
+
targetScope = path2.scope.parent;
|
|
46352
46352
|
}
|
|
46353
46353
|
if (targetScope.path.isProgram() || targetScope.path.isFunction()) {
|
|
46354
46354
|
for (const name of Object.keys(this.bindings)) {
|
|
@@ -46359,18 +46359,18 @@ var require_hoister = __commonJS((exports) => {
|
|
|
46359
46359
|
continue;
|
|
46360
46360
|
}
|
|
46361
46361
|
const bindingParentPath = this.getAttachmentParentForPath(binding.path);
|
|
46362
|
-
if (bindingParentPath.key >=
|
|
46362
|
+
if (bindingParentPath.key >= path2.key) {
|
|
46363
46363
|
this.attachAfter = true;
|
|
46364
|
-
|
|
46364
|
+
path2 = binding.path;
|
|
46365
46365
|
for (const violationPath of binding.constantViolations) {
|
|
46366
|
-
if (this.getAttachmentParentForPath(violationPath).key >
|
|
46367
|
-
|
|
46366
|
+
if (this.getAttachmentParentForPath(violationPath).key > path2.key) {
|
|
46367
|
+
path2 = violationPath;
|
|
46368
46368
|
}
|
|
46369
46369
|
}
|
|
46370
46370
|
}
|
|
46371
46371
|
}
|
|
46372
46372
|
}
|
|
46373
|
-
return
|
|
46373
|
+
return path2;
|
|
46374
46374
|
}
|
|
46375
46375
|
_getAttachmentPath() {
|
|
46376
46376
|
const scopes = this.scopes;
|
|
@@ -46399,12 +46399,12 @@ var require_hoister = __commonJS((exports) => {
|
|
|
46399
46399
|
if (scope)
|
|
46400
46400
|
return this.getAttachmentParentForPath(scope.path);
|
|
46401
46401
|
}
|
|
46402
|
-
getAttachmentParentForPath(
|
|
46402
|
+
getAttachmentParentForPath(path2) {
|
|
46403
46403
|
do {
|
|
46404
|
-
if (!
|
|
46405
|
-
return
|
|
46404
|
+
if (!path2.parentPath || Array.isArray(path2.container) && path2.isStatement()) {
|
|
46405
|
+
return path2;
|
|
46406
46406
|
}
|
|
46407
|
-
} while (
|
|
46407
|
+
} while (path2 = path2.parentPath);
|
|
46408
46408
|
}
|
|
46409
46409
|
hasOwnParamBindings(scope) {
|
|
46410
46410
|
for (const name of Object.keys(this.bindings)) {
|
|
@@ -46474,18 +46474,18 @@ var require_modification = __commonJS((exports) => {
|
|
|
46474
46474
|
for (let i = 0;i < nodes.length; i++) {
|
|
46475
46475
|
var _this$context;
|
|
46476
46476
|
const to = from + i;
|
|
46477
|
-
const
|
|
46478
|
-
paths.push(
|
|
46477
|
+
const path2 = this.getSibling(to);
|
|
46478
|
+
paths.push(path2);
|
|
46479
46479
|
if ((_this$context = this.context) != null && _this$context.queue) {
|
|
46480
|
-
|
|
46480
|
+
path2.pushContext(this.context);
|
|
46481
46481
|
}
|
|
46482
46482
|
}
|
|
46483
46483
|
const contexts = this._getQueueContexts();
|
|
46484
|
-
for (const
|
|
46485
|
-
|
|
46486
|
-
|
|
46484
|
+
for (const path2 of paths) {
|
|
46485
|
+
path2.setScope();
|
|
46486
|
+
path2.debug("Inserted.");
|
|
46487
46487
|
for (const context of contexts) {
|
|
46488
|
-
context.maybeQueue(
|
|
46488
|
+
context.maybeQueue(path2, true);
|
|
46489
46489
|
}
|
|
46490
46490
|
}
|
|
46491
46491
|
return paths;
|
|
@@ -46496,8 +46496,8 @@ var require_modification = __commonJS((exports) => {
|
|
|
46496
46496
|
var _containerInsertAfter = function(nodes) {
|
|
46497
46497
|
return this._containerInsert(this.key + 1, nodes);
|
|
46498
46498
|
};
|
|
46499
|
-
var isHiddenInSequenceExpression = function(
|
|
46500
|
-
return isSequenceExpression(
|
|
46499
|
+
var isHiddenInSequenceExpression = function(path2) {
|
|
46500
|
+
return isSequenceExpression(path2.parent) && (last(path2.parent.expressions) !== path2.node || isHiddenInSequenceExpression(path2.parentPath));
|
|
46501
46501
|
};
|
|
46502
46502
|
var isAlmostConstantAssignment = function(node, scope) {
|
|
46503
46503
|
if (!isAssignmentExpression(node) || !isIdentifier(node.left)) {
|
|
@@ -46570,9 +46570,9 @@ var require_modification = __commonJS((exports) => {
|
|
|
46570
46570
|
if (!this.parent)
|
|
46571
46571
|
return;
|
|
46572
46572
|
const paths = (0, _cache.getCachedPaths)(this.hub, this.parent) || [];
|
|
46573
|
-
for (const [,
|
|
46574
|
-
if (typeof
|
|
46575
|
-
|
|
46573
|
+
for (const [, path2] of paths) {
|
|
46574
|
+
if (typeof path2.key === "number" && path2.key >= fromIndex) {
|
|
46575
|
+
path2.key += incrementBy;
|
|
46576
46576
|
}
|
|
46577
46577
|
}
|
|
46578
46578
|
};
|
|
@@ -46605,27 +46605,27 @@ var require_modification = __commonJS((exports) => {
|
|
|
46605
46605
|
var unshiftContainer = function(listKey, nodes) {
|
|
46606
46606
|
this._assertUnremoved();
|
|
46607
46607
|
nodes = this._verifyNodeList(nodes);
|
|
46608
|
-
const
|
|
46608
|
+
const path2 = _index.default.get({
|
|
46609
46609
|
parentPath: this,
|
|
46610
46610
|
parent: this.node,
|
|
46611
46611
|
container: this.node[listKey],
|
|
46612
46612
|
listKey,
|
|
46613
46613
|
key: 0
|
|
46614
46614
|
}).setContext(this.context);
|
|
46615
|
-
return
|
|
46615
|
+
return path2._containerInsertBefore(nodes);
|
|
46616
46616
|
};
|
|
46617
46617
|
var pushContainer = function(listKey, nodes) {
|
|
46618
46618
|
this._assertUnremoved();
|
|
46619
46619
|
const verifiedNodes = this._verifyNodeList(nodes);
|
|
46620
46620
|
const container = this.node[listKey];
|
|
46621
|
-
const
|
|
46621
|
+
const path2 = _index.default.get({
|
|
46622
46622
|
parentPath: this,
|
|
46623
46623
|
parent: this.node,
|
|
46624
46624
|
container,
|
|
46625
46625
|
listKey,
|
|
46626
46626
|
key: container.length
|
|
46627
46627
|
}).setContext(this.context);
|
|
46628
|
-
return
|
|
46628
|
+
return path2.replaceWithMultiple(verifiedNodes);
|
|
46629
46629
|
};
|
|
46630
46630
|
var hoist = function(scope = this.scope) {
|
|
46631
46631
|
const hoister = new _hoister.default(this, scope);
|
|
@@ -46670,16 +46670,16 @@ var require_modification = __commonJS((exports) => {
|
|
|
46670
46670
|
|
|
46671
46671
|
// ../../../../node_modules/@babel/traverse/lib/path/family.js
|
|
46672
46672
|
var require_family = __commonJS((exports) => {
|
|
46673
|
-
var NormalCompletion = function(
|
|
46673
|
+
var NormalCompletion = function(path2) {
|
|
46674
46674
|
return {
|
|
46675
46675
|
type: NORMAL_COMPLETION,
|
|
46676
|
-
path:
|
|
46676
|
+
path: path2
|
|
46677
46677
|
};
|
|
46678
46678
|
};
|
|
46679
|
-
var BreakCompletion = function(
|
|
46679
|
+
var BreakCompletion = function(path2) {
|
|
46680
46680
|
return {
|
|
46681
46681
|
type: BREAK_COMPLETION,
|
|
46682
|
-
path:
|
|
46682
|
+
path: path2
|
|
46683
46683
|
};
|
|
46684
46684
|
};
|
|
46685
46685
|
var getOpposite = function() {
|
|
@@ -46690,9 +46690,9 @@ var require_family = __commonJS((exports) => {
|
|
|
46690
46690
|
}
|
|
46691
46691
|
return null;
|
|
46692
46692
|
};
|
|
46693
|
-
var addCompletionRecords = function(
|
|
46694
|
-
if (
|
|
46695
|
-
records.push(..._getCompletionRecords(
|
|
46693
|
+
var addCompletionRecords = function(path2, records, context) {
|
|
46694
|
+
if (path2) {
|
|
46695
|
+
records.push(..._getCompletionRecords(path2, context));
|
|
46696
46696
|
}
|
|
46697
46697
|
return records;
|
|
46698
46698
|
};
|
|
@@ -46742,16 +46742,16 @@ var require_family = __commonJS((exports) => {
|
|
|
46742
46742
|
if (context.canHaveBreak) {
|
|
46743
46743
|
let lastNormalCompletions = [];
|
|
46744
46744
|
for (let i = 0;i < paths.length; i++) {
|
|
46745
|
-
const
|
|
46745
|
+
const path2 = paths[i];
|
|
46746
46746
|
const newContext = Object.assign({}, context, {
|
|
46747
46747
|
inCaseClause: false
|
|
46748
46748
|
});
|
|
46749
|
-
if (
|
|
46749
|
+
if (path2.isBlockStatement() && (context.inCaseClause || context.shouldPopulateBreak)) {
|
|
46750
46750
|
newContext.shouldPopulateBreak = true;
|
|
46751
46751
|
} else {
|
|
46752
46752
|
newContext.shouldPopulateBreak = false;
|
|
46753
46753
|
}
|
|
46754
|
-
const statementCompletions = _getCompletionRecords(
|
|
46754
|
+
const statementCompletions = _getCompletionRecords(path2, newContext);
|
|
46755
46755
|
if (statementCompletions.length > 0 && statementCompletions.every((c2) => c2.type === BREAK_COMPLETION)) {
|
|
46756
46756
|
if (lastNormalCompletions.length > 0 && statementCompletions.every((c2) => c2.path.isBreakStatement({
|
|
46757
46757
|
label: null
|
|
@@ -46797,34 +46797,34 @@ var require_family = __commonJS((exports) => {
|
|
|
46797
46797
|
}
|
|
46798
46798
|
return completions;
|
|
46799
46799
|
};
|
|
46800
|
-
var _getCompletionRecords = function(
|
|
46800
|
+
var _getCompletionRecords = function(path2, context) {
|
|
46801
46801
|
let records = [];
|
|
46802
|
-
if (
|
|
46803
|
-
records = addCompletionRecords(
|
|
46804
|
-
records = addCompletionRecords(
|
|
46805
|
-
} else if (
|
|
46806
|
-
return addCompletionRecords(
|
|
46807
|
-
} else if (
|
|
46808
|
-
return getStatementListCompletion(
|
|
46809
|
-
} else if (
|
|
46810
|
-
return _getCompletionRecords(
|
|
46811
|
-
} else if (
|
|
46812
|
-
records = addCompletionRecords(
|
|
46813
|
-
records = addCompletionRecords(
|
|
46814
|
-
} else if (
|
|
46815
|
-
return addCompletionRecords(
|
|
46816
|
-
} else if (
|
|
46817
|
-
return completionRecordForSwitch(
|
|
46818
|
-
} else if (
|
|
46819
|
-
return getStatementListCompletion(
|
|
46802
|
+
if (path2.isIfStatement()) {
|
|
46803
|
+
records = addCompletionRecords(path2.get("consequent"), records, context);
|
|
46804
|
+
records = addCompletionRecords(path2.get("alternate"), records, context);
|
|
46805
|
+
} else if (path2.isDoExpression() || path2.isFor() || path2.isWhile() || path2.isLabeledStatement()) {
|
|
46806
|
+
return addCompletionRecords(path2.get("body"), records, context);
|
|
46807
|
+
} else if (path2.isProgram() || path2.isBlockStatement()) {
|
|
46808
|
+
return getStatementListCompletion(path2.get("body"), context);
|
|
46809
|
+
} else if (path2.isFunction()) {
|
|
46810
|
+
return _getCompletionRecords(path2.get("body"), context);
|
|
46811
|
+
} else if (path2.isTryStatement()) {
|
|
46812
|
+
records = addCompletionRecords(path2.get("block"), records, context);
|
|
46813
|
+
records = addCompletionRecords(path2.get("handler"), records, context);
|
|
46814
|
+
} else if (path2.isCatchClause()) {
|
|
46815
|
+
return addCompletionRecords(path2.get("body"), records, context);
|
|
46816
|
+
} else if (path2.isSwitchStatement()) {
|
|
46817
|
+
return completionRecordForSwitch(path2.get("cases"), records, context);
|
|
46818
|
+
} else if (path2.isSwitchCase()) {
|
|
46819
|
+
return getStatementListCompletion(path2.get("consequent"), {
|
|
46820
46820
|
canHaveBreak: true,
|
|
46821
46821
|
shouldPopulateBreak: false,
|
|
46822
46822
|
inCaseClause: true
|
|
46823
46823
|
});
|
|
46824
|
-
} else if (
|
|
46825
|
-
records.push(BreakCompletion(
|
|
46824
|
+
} else if (path2.isBreakStatement()) {
|
|
46825
|
+
records.push(BreakCompletion(path2));
|
|
46826
46826
|
} else {
|
|
46827
|
-
records.push(NormalCompletion(
|
|
46827
|
+
records.push(NormalCompletion(path2));
|
|
46828
46828
|
}
|
|
46829
46829
|
return records;
|
|
46830
46830
|
};
|
|
@@ -46904,19 +46904,19 @@ var require_family = __commonJS((exports) => {
|
|
|
46904
46904
|
}
|
|
46905
46905
|
};
|
|
46906
46906
|
var _getPattern = function(parts, context) {
|
|
46907
|
-
let
|
|
46907
|
+
let path2 = this;
|
|
46908
46908
|
for (const part of parts) {
|
|
46909
46909
|
if (part === ".") {
|
|
46910
|
-
|
|
46910
|
+
path2 = path2.parentPath;
|
|
46911
46911
|
} else {
|
|
46912
|
-
if (Array.isArray(
|
|
46913
|
-
|
|
46912
|
+
if (Array.isArray(path2)) {
|
|
46913
|
+
path2 = path2[part];
|
|
46914
46914
|
} else {
|
|
46915
|
-
|
|
46915
|
+
path2 = path2.get(part, context);
|
|
46916
46916
|
}
|
|
46917
46917
|
}
|
|
46918
46918
|
}
|
|
46919
|
-
return
|
|
46919
|
+
return path2;
|
|
46920
46920
|
};
|
|
46921
46921
|
var getBindingIdentifiers = function(duplicates) {
|
|
46922
46922
|
return _getBindingIdentifiers(this.node, duplicates);
|
|
@@ -46925,8 +46925,8 @@ var require_family = __commonJS((exports) => {
|
|
|
46925
46925
|
return _getOuterBindingIdentifiers(this.node, duplicates);
|
|
46926
46926
|
};
|
|
46927
46927
|
var getBindingIdentifierPaths = function(duplicates = false, outerOnly = false) {
|
|
46928
|
-
const
|
|
46929
|
-
const search = [
|
|
46928
|
+
const path2 = this;
|
|
46929
|
+
const search = [path2];
|
|
46930
46930
|
const ids = Object.create(null);
|
|
46931
46931
|
while (search.length) {
|
|
46932
46932
|
const id = search.shift();
|
|
@@ -47134,14 +47134,14 @@ var require_path = __commonJS((exports) => {
|
|
|
47134
47134
|
}
|
|
47135
47135
|
const targetNode = container[key];
|
|
47136
47136
|
const paths = cache2.getOrCreateCachedPaths(hub, parent);
|
|
47137
|
-
let
|
|
47138
|
-
if (!
|
|
47139
|
-
|
|
47137
|
+
let path2 = paths.get(targetNode);
|
|
47138
|
+
if (!path2) {
|
|
47139
|
+
path2 = new NodePath(hub, parent);
|
|
47140
47140
|
if (targetNode)
|
|
47141
|
-
paths.set(targetNode,
|
|
47141
|
+
paths.set(targetNode, path2);
|
|
47142
47142
|
}
|
|
47143
|
-
|
|
47144
|
-
return
|
|
47143
|
+
path2.setup(parentPath, container, listKey, key);
|
|
47144
|
+
return path2;
|
|
47145
47145
|
}
|
|
47146
47146
|
getScope(scope) {
|
|
47147
47147
|
return this.isScope() ? new _index2.default(this) : scope;
|
|
@@ -47176,13 +47176,13 @@ var require_path = __commonJS((exports) => {
|
|
|
47176
47176
|
}
|
|
47177
47177
|
getPathLocation() {
|
|
47178
47178
|
const parts = [];
|
|
47179
|
-
let
|
|
47179
|
+
let path2 = this;
|
|
47180
47180
|
do {
|
|
47181
|
-
let key =
|
|
47182
|
-
if (
|
|
47183
|
-
key = `${
|
|
47181
|
+
let key = path2.key;
|
|
47182
|
+
if (path2.inList)
|
|
47183
|
+
key = `${path2.listKey}[${key}]`;
|
|
47184
47184
|
parts.unshift(key);
|
|
47185
|
-
} while (
|
|
47185
|
+
} while (path2 = path2.parentPath);
|
|
47186
47186
|
return parts.join(".");
|
|
47187
47187
|
}
|
|
47188
47188
|
debug(message) {
|
|
@@ -47307,12 +47307,12 @@ var require_context2 = __commonJS((exports) => {
|
|
|
47307
47307
|
listKey
|
|
47308
47308
|
});
|
|
47309
47309
|
}
|
|
47310
|
-
maybeQueue(
|
|
47310
|
+
maybeQueue(path2, notPriority) {
|
|
47311
47311
|
if (this.queue) {
|
|
47312
47312
|
if (notPriority) {
|
|
47313
|
-
this.queue.push(
|
|
47313
|
+
this.queue.push(path2);
|
|
47314
47314
|
} else {
|
|
47315
|
-
this.priorityQueue.push(
|
|
47315
|
+
this.priorityQueue.push(path2);
|
|
47316
47316
|
}
|
|
47317
47317
|
}
|
|
47318
47318
|
}
|
|
@@ -47342,22 +47342,22 @@ var require_context2 = __commonJS((exports) => {
|
|
|
47342
47342
|
let stop = false;
|
|
47343
47343
|
let visitIndex = 0;
|
|
47344
47344
|
for (;visitIndex < queue3.length; ) {
|
|
47345
|
-
const
|
|
47345
|
+
const path2 = queue3[visitIndex];
|
|
47346
47346
|
visitIndex++;
|
|
47347
|
-
|
|
47348
|
-
if (
|
|
47349
|
-
|
|
47347
|
+
path2.resync();
|
|
47348
|
+
if (path2.contexts.length === 0 || path2.contexts[path2.contexts.length - 1] !== this) {
|
|
47349
|
+
path2.pushContext(this);
|
|
47350
47350
|
}
|
|
47351
|
-
if (
|
|
47351
|
+
if (path2.key === null)
|
|
47352
47352
|
continue;
|
|
47353
47353
|
const {
|
|
47354
47354
|
node
|
|
47355
|
-
} =
|
|
47355
|
+
} = path2;
|
|
47356
47356
|
if (visited.has(node))
|
|
47357
47357
|
continue;
|
|
47358
47358
|
if (node)
|
|
47359
47359
|
visited.add(node);
|
|
47360
|
-
if (
|
|
47360
|
+
if (path2.visit()) {
|
|
47361
47361
|
stop = true;
|
|
47362
47362
|
break;
|
|
47363
47363
|
}
|
|
@@ -47391,15 +47391,15 @@ var require_context2 = __commonJS((exports) => {
|
|
|
47391
47391
|
|
|
47392
47392
|
// ../../../../node_modules/@babel/traverse/lib/traverse-node.js
|
|
47393
47393
|
var require_traverse_node = __commonJS((exports) => {
|
|
47394
|
-
var traverseNode = function(node, opts, scope, state,
|
|
47394
|
+
var traverseNode = function(node, opts, scope, state, path2, skipKeys, visitSelf) {
|
|
47395
47395
|
const keys = VISITOR_KEYS[node.type];
|
|
47396
47396
|
if (!keys)
|
|
47397
47397
|
return false;
|
|
47398
|
-
const context = new _context.default(scope, opts, state,
|
|
47398
|
+
const context = new _context.default(scope, opts, state, path2);
|
|
47399
47399
|
if (visitSelf) {
|
|
47400
|
-
if (skipKeys != null && skipKeys[
|
|
47400
|
+
if (skipKeys != null && skipKeys[path2.parentKey])
|
|
47401
47401
|
return false;
|
|
47402
|
-
return context.visitQueue([
|
|
47402
|
+
return context.visitQueue([path2]);
|
|
47403
47403
|
}
|
|
47404
47404
|
for (const key of keys) {
|
|
47405
47405
|
if (skipKeys != null && skipKeys[key])
|
|
@@ -47462,10 +47462,10 @@ var require_lib14 = __commonJS((exports) => {
|
|
|
47462
47462
|
visitors.explode(opts);
|
|
47463
47463
|
(0, _traverseNode.traverseNode)(parent, opts, scope, state, parentPath, null, visitSelf);
|
|
47464
47464
|
};
|
|
47465
|
-
var hasDenylistedType = function(
|
|
47466
|
-
if (
|
|
47465
|
+
var hasDenylistedType = function(path2, state) {
|
|
47466
|
+
if (path2.node.type === state.type) {
|
|
47467
47467
|
state.has = true;
|
|
47468
|
-
|
|
47468
|
+
path2.stop();
|
|
47469
47469
|
}
|
|
47470
47470
|
};
|
|
47471
47471
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -47511,8 +47511,8 @@ var require_lib14 = __commonJS((exports) => {
|
|
|
47511
47511
|
traverseFast(node, enter);
|
|
47512
47512
|
return;
|
|
47513
47513
|
};
|
|
47514
|
-
traverse.node = function(node, opts, scope, state,
|
|
47515
|
-
(0, _traverseNode.traverseNode)(node, opts, scope, state,
|
|
47514
|
+
traverse.node = function(node, opts, scope, state, path2, skipKeys) {
|
|
47515
|
+
(0, _traverseNode.traverseNode)(node, opts, scope, state, path2, skipKeys);
|
|
47516
47516
|
};
|
|
47517
47517
|
traverse.clearNode = function(node, opts) {
|
|
47518
47518
|
removeProperties(node, opts);
|
|
@@ -47540,20 +47540,15 @@ var require_lib14 = __commonJS((exports) => {
|
|
|
47540
47540
|
traverse.cache = cache2;
|
|
47541
47541
|
});
|
|
47542
47542
|
|
|
47543
|
-
// ../../../../node_modules
|
|
47543
|
+
// ../../../../node_modules/validator/lib/util/assertString.js
|
|
47544
47544
|
var require_assertString = __commonJS((exports, module) => {
|
|
47545
|
-
var _typeof = function(
|
|
47545
|
+
var _typeof = function(o) {
|
|
47546
47546
|
"@babel/helpers - typeof";
|
|
47547
|
-
|
|
47548
|
-
|
|
47549
|
-
|
|
47550
|
-
|
|
47551
|
-
}
|
|
47552
|
-
_typeof = function _typeof(obj2) {
|
|
47553
|
-
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
47554
|
-
};
|
|
47555
|
-
}
|
|
47556
|
-
return _typeof(obj);
|
|
47547
|
+
return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o2) {
|
|
47548
|
+
return typeof o2;
|
|
47549
|
+
} : function(o2) {
|
|
47550
|
+
return o2 && typeof Symbol == "function" && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
47551
|
+
}, _typeof(o);
|
|
47557
47552
|
};
|
|
47558
47553
|
var assertString = function(input) {
|
|
47559
47554
|
var isString2 = typeof input === "string" || input instanceof String;
|
|
@@ -47574,7 +47569,7 @@ var require_assertString = __commonJS((exports, module) => {
|
|
|
47574
47569
|
module.exports.default = exports.default;
|
|
47575
47570
|
});
|
|
47576
47571
|
|
|
47577
|
-
// ../../../../node_modules
|
|
47572
|
+
// ../../../../node_modules/validator/lib/isIP.js
|
|
47578
47573
|
var require_isIP = __commonJS((exports, module) => {
|
|
47579
47574
|
var _interopRequireDefault = function(obj) {
|
|
47580
47575
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -47608,7 +47603,7 @@ var require_isIP = __commonJS((exports, module) => {
|
|
|
47608
47603
|
module.exports.default = exports.default;
|
|
47609
47604
|
});
|
|
47610
47605
|
|
|
47611
|
-
// ../../../../node_modules
|
|
47606
|
+
// ../../../../node_modules/validator/lib/util/merge.js
|
|
47612
47607
|
var require_merge = __commonJS((exports, module) => {
|
|
47613
47608
|
var merge = function() {
|
|
47614
47609
|
var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -47628,7 +47623,7 @@ var require_merge = __commonJS((exports, module) => {
|
|
|
47628
47623
|
module.exports.default = exports.default;
|
|
47629
47624
|
});
|
|
47630
47625
|
|
|
47631
|
-
// ../../../../node_modules
|
|
47626
|
+
// ../../../../node_modules/validator/lib/isBase64.js
|
|
47632
47627
|
var require_isBase64 = __commonJS((exports, module) => {
|
|
47633
47628
|
var _interopRequireDefault = function(obj) {
|
|
47634
47629
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -47661,7 +47656,7 @@ var require_isBase64 = __commonJS((exports, module) => {
|
|
|
47661
47656
|
module.exports.default = exports.default;
|
|
47662
47657
|
});
|
|
47663
47658
|
|
|
47664
|
-
// ../../../../node_modules
|
|
47659
|
+
// ../../../../node_modules/validator/lib/isJWT.js
|
|
47665
47660
|
var require_isJWT = __commonJS((exports, module) => {
|
|
47666
47661
|
var _interopRequireDefault = function(obj) {
|
|
47667
47662
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -47689,7 +47684,7 @@ var require_isJWT = __commonJS((exports, module) => {
|
|
|
47689
47684
|
module.exports.default = exports.default;
|
|
47690
47685
|
});
|
|
47691
47686
|
|
|
47692
|
-
// ../../../../node_modules
|
|
47687
|
+
// ../../../../node_modules/validator/lib/isFQDN.js
|
|
47693
47688
|
var require_isFQDN = __commonJS((exports, module) => {
|
|
47694
47689
|
var _interopRequireDefault = function(obj) {
|
|
47695
47690
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -47756,7 +47751,7 @@ var require_isFQDN = __commonJS((exports, module) => {
|
|
|
47756
47751
|
module.exports.default = exports.default;
|
|
47757
47752
|
});
|
|
47758
47753
|
|
|
47759
|
-
// ../../../../node_modules
|
|
47754
|
+
// ../../../../node_modules/validator/lib/isURL.js
|
|
47760
47755
|
var require_isURL = __commonJS((exports, module) => {
|
|
47761
47756
|
var _interopRequireDefault = function(obj) {
|
|
47762
47757
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -47783,37 +47778,35 @@ var require_isURL = __commonJS((exports, module) => {
|
|
|
47783
47778
|
var _arrayLikeToArray = function(arr, len) {
|
|
47784
47779
|
if (len == null || len > arr.length)
|
|
47785
47780
|
len = arr.length;
|
|
47786
|
-
for (var i = 0, arr2 = new Array(len);i < len; i++)
|
|
47781
|
+
for (var i = 0, arr2 = new Array(len);i < len; i++)
|
|
47787
47782
|
arr2[i] = arr[i];
|
|
47788
|
-
}
|
|
47789
47783
|
return arr2;
|
|
47790
47784
|
};
|
|
47791
|
-
var _iterableToArrayLimit = function(
|
|
47792
|
-
|
|
47793
|
-
|
|
47794
|
-
|
|
47795
|
-
var _n = true;
|
|
47796
|
-
var _d = false;
|
|
47797
|
-
var _e = undefined;
|
|
47798
|
-
try {
|
|
47799
|
-
for (var _i = arr[Symbol.iterator](), _s;!(_n = (_s = _i.next()).done); _n = true) {
|
|
47800
|
-
_arr.push(_s.value);
|
|
47801
|
-
if (i && _arr.length === i)
|
|
47802
|
-
break;
|
|
47803
|
-
}
|
|
47804
|
-
} catch (err2) {
|
|
47805
|
-
_d = true;
|
|
47806
|
-
_e = err2;
|
|
47807
|
-
} finally {
|
|
47785
|
+
var _iterableToArrayLimit = function(r2, l2) {
|
|
47786
|
+
var t = r2 == null ? null : typeof Symbol != "undefined" && r2[Symbol.iterator] || r2["@@iterator"];
|
|
47787
|
+
if (t != null) {
|
|
47788
|
+
var e, n, i, u, a = [], f2 = true, o = false;
|
|
47808
47789
|
try {
|
|
47809
|
-
if (
|
|
47810
|
-
|
|
47790
|
+
if (i = (t = t.call(r2)).next, l2 === 0) {
|
|
47791
|
+
if (Object(t) !== t)
|
|
47792
|
+
return;
|
|
47793
|
+
f2 = false;
|
|
47794
|
+
} else
|
|
47795
|
+
for (;!(f2 = (e = i.call(t)).done) && (a.push(e.value), a.length !== l2); f2 = true)
|
|
47796
|
+
;
|
|
47797
|
+
} catch (r3) {
|
|
47798
|
+
o = true, n = r3;
|
|
47811
47799
|
} finally {
|
|
47812
|
-
|
|
47813
|
-
|
|
47800
|
+
try {
|
|
47801
|
+
if (!f2 && t.return != null && (u = t.return(), Object(u) !== u))
|
|
47802
|
+
return;
|
|
47803
|
+
} finally {
|
|
47804
|
+
if (o)
|
|
47805
|
+
throw n;
|
|
47806
|
+
}
|
|
47814
47807
|
}
|
|
47808
|
+
return a;
|
|
47815
47809
|
}
|
|
47816
|
-
return _arr;
|
|
47817
47810
|
};
|
|
47818
47811
|
var _arrayWithHoles = function(arr) {
|
|
47819
47812
|
if (Array.isArray(arr))
|
|
@@ -47959,7 +47952,7 @@ var require_isURL = __commonJS((exports, module) => {
|
|
|
47959
47952
|
module.exports.default = exports.default;
|
|
47960
47953
|
});
|
|
47961
47954
|
|
|
47962
|
-
// ../../../../node_modules
|
|
47955
|
+
// ../../../../node_modules/validator/lib/isSlug.js
|
|
47963
47956
|
var require_isSlug = __commonJS((exports, module) => {
|
|
47964
47957
|
var _interopRequireDefault = function(obj) {
|
|
47965
47958
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -47978,7 +47971,7 @@ var require_isSlug = __commonJS((exports, module) => {
|
|
|
47978
47971
|
module.exports.default = exports.default;
|
|
47979
47972
|
});
|
|
47980
47973
|
|
|
47981
|
-
// ../../../../node_modules
|
|
47974
|
+
// ../../../../node_modules/validator/lib/isIBAN.js
|
|
47982
47975
|
var require_isIBAN = __commonJS((exports) => {
|
|
47983
47976
|
var _interopRequireDefault = function(obj) {
|
|
47984
47977
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -48054,6 +48047,7 @@ var require_isIBAN = __commonJS((exports) => {
|
|
|
48054
48047
|
DE: /^(DE[0-9]{2})\d{18}$/,
|
|
48055
48048
|
DK: /^(DK[0-9]{2})\d{14}$/,
|
|
48056
48049
|
DO: /^(DO[0-9]{2})[A-Z]{4}\d{20}$/,
|
|
48050
|
+
DZ: /^(DZ\d{24})$/,
|
|
48057
48051
|
EE: /^(EE[0-9]{2})\d{16}$/,
|
|
48058
48052
|
EG: /^(EG[0-9]{2})\d{25}$/,
|
|
48059
48053
|
ES: /^(ES[0-9]{2})\d{20}$/,
|
|
@@ -48116,11 +48110,10 @@ var require_isIBAN = __commonJS((exports) => {
|
|
|
48116
48110
|
VG: /^(VG[0-9]{2})[A-Z0-9]{4}\d{16}$/,
|
|
48117
48111
|
XK: /^(XK[0-9]{2})\d{16}$/
|
|
48118
48112
|
};
|
|
48119
|
-
var locales = Object.keys(ibanRegexThroughCountryCode);
|
|
48120
|
-
exports.locales = locales;
|
|
48113
|
+
var locales = exports.locales = Object.keys(ibanRegexThroughCountryCode);
|
|
48121
48114
|
});
|
|
48122
48115
|
|
|
48123
|
-
// ../../../../node_modules
|
|
48116
|
+
// ../../../../node_modules/validator/lib/isUUID.js
|
|
48124
48117
|
var require_isUUID = __commonJS((exports, module) => {
|
|
48125
48118
|
var _interopRequireDefault = function(obj) {
|
|
48126
48119
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -48141,13 +48134,14 @@ var require_isUUID = __commonJS((exports, module) => {
|
|
|
48141
48134
|
3: /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,
|
|
48142
48135
|
4: /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
|
|
48143
48136
|
5: /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
|
|
48137
|
+
7: /^[0-9A-F]{8}-[0-9A-F]{4}-7[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
|
|
48144
48138
|
all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i
|
|
48145
48139
|
};
|
|
48146
48140
|
module.exports = exports.default;
|
|
48147
48141
|
module.exports.default = exports.default;
|
|
48148
48142
|
});
|
|
48149
48143
|
|
|
48150
|
-
// ../../../../node_modules
|
|
48144
|
+
// ../../../../node_modules/validator/lib/isAscii.js
|
|
48151
48145
|
var require_isAscii = __commonJS((exports, module) => {
|
|
48152
48146
|
var _interopRequireDefault = function(obj) {
|
|
48153
48147
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -48166,23 +48160,18 @@ var require_isAscii = __commonJS((exports, module) => {
|
|
|
48166
48160
|
module.exports.default = exports.default;
|
|
48167
48161
|
});
|
|
48168
48162
|
|
|
48169
|
-
// ../../../../node_modules
|
|
48163
|
+
// ../../../../node_modules/validator/lib/isByteLength.js
|
|
48170
48164
|
var require_isByteLength = __commonJS((exports, module) => {
|
|
48171
48165
|
var _interopRequireDefault = function(obj) {
|
|
48172
48166
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
48173
48167
|
};
|
|
48174
|
-
var _typeof = function(
|
|
48168
|
+
var _typeof = function(o) {
|
|
48175
48169
|
"@babel/helpers - typeof";
|
|
48176
|
-
|
|
48177
|
-
|
|
48178
|
-
|
|
48179
|
-
|
|
48180
|
-
}
|
|
48181
|
-
_typeof = function _typeof(obj2) {
|
|
48182
|
-
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
48183
|
-
};
|
|
48184
|
-
}
|
|
48185
|
-
return _typeof(obj);
|
|
48170
|
+
return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o2) {
|
|
48171
|
+
return typeof o2;
|
|
48172
|
+
} : function(o2) {
|
|
48173
|
+
return o2 && typeof Symbol == "function" && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
48174
|
+
}, _typeof(o);
|
|
48186
48175
|
};
|
|
48187
48176
|
var isByteLength = function(str, options) {
|
|
48188
48177
|
(0, _assertString.default)(str);
|
|
@@ -48207,7 +48196,7 @@ var require_isByteLength = __commonJS((exports, module) => {
|
|
|
48207
48196
|
module.exports.default = exports.default;
|
|
48208
48197
|
});
|
|
48209
48198
|
|
|
48210
|
-
// ../../../../node_modules
|
|
48199
|
+
// ../../../../node_modules/validator/lib/isEmail.js
|
|
48211
48200
|
var require_isEmail = __commonJS((exports, module) => {
|
|
48212
48201
|
var _interopRequireDefault = function(obj) {
|
|
48213
48202
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -48349,13 +48338,13 @@ var require_isEmail = __commonJS((exports, module) => {
|
|
|
48349
48338
|
module.exports.default = exports.default;
|
|
48350
48339
|
});
|
|
48351
48340
|
|
|
48352
|
-
// ../../../../node_modules
|
|
48341
|
+
// ../../../../node_modules/validator/lib/alpha.js
|
|
48353
48342
|
var require_alpha = __commonJS((exports) => {
|
|
48354
48343
|
Object.defineProperty(exports, "__esModule", {
|
|
48355
48344
|
value: true
|
|
48356
48345
|
});
|
|
48357
|
-
exports.
|
|
48358
|
-
var alpha = {
|
|
48346
|
+
exports.farsiLocales = exports.englishLocales = exports.dotDecimal = exports.decimal = exports.commaDecimal = exports.bengaliLocales = exports.arabicLocales = exports.alphanumeric = exports.alpha = undefined;
|
|
48347
|
+
var alpha = exports.alpha = {
|
|
48359
48348
|
"en-US": /^[A-Z]+$/i,
|
|
48360
48349
|
"az-AZ": /^[A-VXYZ\u00C7\u018F\u011E\u0130\u0131\u00D6\u015E\u00DC]+$/i,
|
|
48361
48350
|
"bg-BG": /^[\u0410-\u042F]+$/i,
|
|
@@ -48392,11 +48381,11 @@ var require_alpha = __commonJS((exports) => {
|
|
|
48392
48381
|
he: /^[\u05D0-\u05EA]+$/,
|
|
48393
48382
|
fa: /^['\u0622\u0627\u0621\u0623\u0624\u0626\u0628\u067E\u062A\u062B\u062C\u0686\u062D\u062E\u062F\u0630\u0631\u0632\u0698\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063A\u0641\u0642\u06A9\u06AF\u0644\u0645\u0646\u0648\u0647\u0629\u06CC']+$/i,
|
|
48394
48383
|
bn: /^['\u0980\u0981\u0982\u0983\u0985\u0986\u0987\u0988\u0989\u098A\u098B\u098C\u098F\u0990\u0993\u0994\u0995\u0996\u0997\u0998\u0999\u099A\u099B\u099C\u099D\u099E\u099F\u09A0\u09A1\u09A2\u09A3\u09A4\u09A5\u09A6\u09A7\u09A8\u09AA\u09AB\u09AC\u09AD\u09AE\u09AF\u09B0\u09B2\u09B6\u09B7\u09B8\u09B9\u09BC\u09BD\u09BE\u09BF\u09C0\u09C1\u09C2\u09C3\u09C4\u09C7\u09C8\u09CB\u09CC\u09CD\u09CE\u09D7\u09DC\u09DD\u09DF\u09E0\u09E1\u09E2\u09E3\u09F0\u09F1\u09F2\u09F3\u09F4\u09F5\u09F6\u09F7\u09F8\u09F9\u09FA\u09FB']+$/,
|
|
48384
|
+
eo: /^[ABC\u0108D-G\u011CH\u0124IJ\u0134K-PRS\u015CTU\u016CVZ]+$/i,
|
|
48395
48385
|
"hi-IN": /^[\u0900-\u0961]+[\u0972-\u097F]*$/i,
|
|
48396
48386
|
"si-LK": /^[\u0D80-\u0DFF]+$/
|
|
48397
48387
|
};
|
|
48398
|
-
exports.
|
|
48399
|
-
var alphanumeric = {
|
|
48388
|
+
var alphanumeric = exports.alphanumeric = {
|
|
48400
48389
|
"en-US": /^[0-9A-Z]+$/i,
|
|
48401
48390
|
"az-AZ": /^[0-9A-VXYZ\u00C7\u018F\u011E\u0130\u0131\u00D6\u015E\u00DC]+$/i,
|
|
48402
48391
|
"bg-BG": /^[0-9\u0410-\u042F]+$/i,
|
|
@@ -48432,17 +48421,15 @@ var require_alpha = __commonJS((exports) => {
|
|
|
48432
48421
|
he: /^[0-9\u05D0-\u05EA]+$/,
|
|
48433
48422
|
fa: /^['0-9\u0622\u0627\u0621\u0623\u0624\u0626\u0628\u067E\u062A\u062B\u062C\u0686\u062D\u062E\u062F\u0630\u0631\u0632\u0698\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063A\u0641\u0642\u06A9\u06AF\u0644\u0645\u0646\u0648\u0647\u0629\u06CC\u06F1\u06F2\u06F3\u06F4\u06F5\u06F6\u06F7\u06F8\u06F9\u06F0']+$/i,
|
|
48434
48423
|
bn: /^['\u0980\u0981\u0982\u0983\u0985\u0986\u0987\u0988\u0989\u098A\u098B\u098C\u098F\u0990\u0993\u0994\u0995\u0996\u0997\u0998\u0999\u099A\u099B\u099C\u099D\u099E\u099F\u09A0\u09A1\u09A2\u09A3\u09A4\u09A5\u09A6\u09A7\u09A8\u09AA\u09AB\u09AC\u09AD\u09AE\u09AF\u09B0\u09B2\u09B6\u09B7\u09B8\u09B9\u09BC\u09BD\u09BE\u09BF\u09C0\u09C1\u09C2\u09C3\u09C4\u09C7\u09C8\u09CB\u09CC\u09CD\u09CE\u09D7\u09DC\u09DD\u09DF\u09E0\u09E1\u09E2\u09E3\u09E6\u09E7\u09E8\u09E9\u09EA\u09EB\u09EC\u09ED\u09EE\u09EF\u09F0\u09F1\u09F2\u09F3\u09F4\u09F5\u09F6\u09F7\u09F8\u09F9\u09FA\u09FB']+$/,
|
|
48424
|
+
eo: /^[0-9ABC\u0108D-G\u011CH\u0124IJ\u0134K-PRS\u015CTU\u016CVZ]+$/i,
|
|
48435
48425
|
"hi-IN": /^[\u0900-\u0963]+[\u0966-\u097F]*$/i,
|
|
48436
48426
|
"si-LK": /^[0-9\u0D80-\u0DFF]+$/
|
|
48437
48427
|
};
|
|
48438
|
-
exports.
|
|
48439
|
-
var decimal = {
|
|
48428
|
+
var decimal = exports.decimal = {
|
|
48440
48429
|
"en-US": ".",
|
|
48441
48430
|
ar: "\u066B"
|
|
48442
48431
|
};
|
|
48443
|
-
exports.
|
|
48444
|
-
var englishLocales = ["AU", "GB", "HK", "IN", "NZ", "ZA", "ZM"];
|
|
48445
|
-
exports.englishLocales = englishLocales;
|
|
48432
|
+
var englishLocales = exports.englishLocales = ["AU", "GB", "HK", "IN", "NZ", "ZA", "ZM"];
|
|
48446
48433
|
for (i = 0;i < englishLocales.length; i++) {
|
|
48447
48434
|
locale = "en-".concat(englishLocales[i]);
|
|
48448
48435
|
alpha[locale] = alpha["en-US"];
|
|
@@ -48451,8 +48438,7 @@ var require_alpha = __commonJS((exports) => {
|
|
|
48451
48438
|
}
|
|
48452
48439
|
var locale;
|
|
48453
48440
|
var i;
|
|
48454
|
-
var arabicLocales = ["AE", "BH", "DZ", "EG", "IQ", "JO", "KW", "LB", "LY", "MA", "QM", "QA", "SA", "SD", "SY", "TN", "YE"];
|
|
48455
|
-
exports.arabicLocales = arabicLocales;
|
|
48441
|
+
var arabicLocales = exports.arabicLocales = ["AE", "BH", "DZ", "EG", "IQ", "JO", "KW", "LB", "LY", "MA", "QM", "QA", "SA", "SD", "SY", "TN", "YE"];
|
|
48456
48442
|
for (_i = 0;_i < arabicLocales.length; _i++) {
|
|
48457
48443
|
_locale = "ar-".concat(arabicLocales[_i]);
|
|
48458
48444
|
alpha[_locale] = alpha.ar;
|
|
@@ -48461,8 +48447,7 @@ var require_alpha = __commonJS((exports) => {
|
|
|
48461
48447
|
}
|
|
48462
48448
|
var _locale;
|
|
48463
48449
|
var _i;
|
|
48464
|
-
var farsiLocales = ["IR", "AF"];
|
|
48465
|
-
exports.farsiLocales = farsiLocales;
|
|
48450
|
+
var farsiLocales = exports.farsiLocales = ["IR", "AF"];
|
|
48466
48451
|
for (_i2 = 0;_i2 < farsiLocales.length; _i2++) {
|
|
48467
48452
|
_locale2 = "fa-".concat(farsiLocales[_i2]);
|
|
48468
48453
|
alphanumeric[_locale2] = alphanumeric.fa;
|
|
@@ -48470,8 +48455,7 @@ var require_alpha = __commonJS((exports) => {
|
|
|
48470
48455
|
}
|
|
48471
48456
|
var _locale2;
|
|
48472
48457
|
var _i2;
|
|
48473
|
-
var bengaliLocales = ["BD", "IN"];
|
|
48474
|
-
exports.bengaliLocales = bengaliLocales;
|
|
48458
|
+
var bengaliLocales = exports.bengaliLocales = ["BD", "IN"];
|
|
48475
48459
|
for (_i3 = 0;_i3 < bengaliLocales.length; _i3++) {
|
|
48476
48460
|
_locale3 = "bn-".concat(bengaliLocales[_i3]);
|
|
48477
48461
|
alpha[_locale3] = alpha.bn;
|
|
@@ -48480,10 +48464,8 @@ var require_alpha = __commonJS((exports) => {
|
|
|
48480
48464
|
}
|
|
48481
48465
|
var _locale3;
|
|
48482
48466
|
var _i3;
|
|
48483
|
-
var dotDecimal = ["ar-EG", "ar-LB", "ar-LY"];
|
|
48484
|
-
exports.
|
|
48485
|
-
var commaDecimal = ["bg-BG", "cs-CZ", "da-DK", "de-DE", "el-GR", "en-ZM", "es-ES", "fr-CA", "fr-FR", "id-ID", "it-IT", "ku-IQ", "hi-IN", "hu-HU", "nb-NO", "nn-NO", "nl-NL", "pl-PL", "pt-PT", "ru-RU", "kk-KZ", "si-LK", "sl-SI", "sr-RS@latin", "sr-RS", "sv-SE", "tr-TR", "uk-UA", "vi-VN"];
|
|
48486
|
-
exports.commaDecimal = commaDecimal;
|
|
48467
|
+
var dotDecimal = exports.dotDecimal = ["ar-EG", "ar-LB", "ar-LY"];
|
|
48468
|
+
var commaDecimal = exports.commaDecimal = ["bg-BG", "cs-CZ", "da-DK", "de-DE", "el-GR", "en-ZM", "eo", "es-ES", "fr-CA", "fr-FR", "id-ID", "it-IT", "ku-IQ", "hi-IN", "hu-HU", "nb-NO", "nn-NO", "nl-NL", "pl-PL", "pt-PT", "ru-RU", "kk-KZ", "si-LK", "sl-SI", "sr-RS@latin", "sr-RS", "sv-SE", "tr-TR", "uk-UA", "vi-VN"];
|
|
48487
48469
|
for (_i4 = 0;_i4 < dotDecimal.length; _i4++) {
|
|
48488
48470
|
decimal[dotDecimal[_i4]] = decimal["en-US"];
|
|
48489
48471
|
}
|
|
@@ -48503,7 +48485,7 @@ var require_alpha = __commonJS((exports) => {
|
|
|
48503
48485
|
alpha["fa-AF"] = alpha.fa;
|
|
48504
48486
|
});
|
|
48505
48487
|
|
|
48506
|
-
// ../../../../node_modules
|
|
48488
|
+
// ../../../../node_modules/validator/lib/isAlpha.js
|
|
48507
48489
|
var require_isAlpha = __commonJS((exports) => {
|
|
48508
48490
|
var _interopRequireDefault = function(obj) {
|
|
48509
48491
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -48535,11 +48517,10 @@ var require_isAlpha = __commonJS((exports) => {
|
|
|
48535
48517
|
exports.locales = undefined;
|
|
48536
48518
|
var _assertString = _interopRequireDefault(require_assertString());
|
|
48537
48519
|
var _alpha = require_alpha();
|
|
48538
|
-
var locales = Object.keys(_alpha.alpha);
|
|
48539
|
-
exports.locales = locales;
|
|
48520
|
+
var locales = exports.locales = Object.keys(_alpha.alpha);
|
|
48540
48521
|
});
|
|
48541
48522
|
|
|
48542
|
-
// ../../../../node_modules
|
|
48523
|
+
// ../../../../node_modules/validator/lib/isLatLong.js
|
|
48543
48524
|
var require_isLatLong = __commonJS((exports, module) => {
|
|
48544
48525
|
var _interopRequireDefault = function(obj) {
|
|
48545
48526
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -48574,7 +48555,7 @@ var require_isLatLong = __commonJS((exports, module) => {
|
|
|
48574
48555
|
module.exports.default = exports.default;
|
|
48575
48556
|
});
|
|
48576
48557
|
|
|
48577
|
-
// ../../../../node_modules
|
|
48558
|
+
// ../../../../node_modules/validator/lib/util/includes.js
|
|
48578
48559
|
var require_includes = __commonJS((exports, module) => {
|
|
48579
48560
|
Object.defineProperty(exports, "__esModule", {
|
|
48580
48561
|
value: true
|
|
@@ -48585,13 +48566,12 @@ var require_includes = __commonJS((exports, module) => {
|
|
|
48585
48566
|
return val === arrVal;
|
|
48586
48567
|
});
|
|
48587
48568
|
};
|
|
48588
|
-
var _default = includes;
|
|
48589
|
-
exports.default = _default;
|
|
48569
|
+
var _default = exports.default = includes;
|
|
48590
48570
|
module.exports = exports.default;
|
|
48591
48571
|
module.exports.default = exports.default;
|
|
48592
48572
|
});
|
|
48593
48573
|
|
|
48594
|
-
// ../../../../node_modules
|
|
48574
|
+
// ../../../../node_modules/validator/lib/isDecimal.js
|
|
48595
48575
|
var require_isDecimal = __commonJS((exports, module) => {
|
|
48596
48576
|
var _interopRequireDefault = function(obj) {
|
|
48597
48577
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -48626,7 +48606,7 @@ var require_isDecimal = __commonJS((exports, module) => {
|
|
|
48626
48606
|
module.exports.default = exports.default;
|
|
48627
48607
|
});
|
|
48628
48608
|
|
|
48629
|
-
// ../../../../node_modules
|
|
48609
|
+
// ../../../../node_modules/validator/lib/isHexColor.js
|
|
48630
48610
|
var require_isHexColor = __commonJS((exports, module) => {
|
|
48631
48611
|
var _interopRequireDefault = function(obj) {
|
|
48632
48612
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -48645,7 +48625,7 @@ var require_isHexColor = __commonJS((exports, module) => {
|
|
|
48645
48625
|
module.exports.default = exports.default;
|
|
48646
48626
|
});
|
|
48647
48627
|
|
|
48648
|
-
// ../../../../node_modules
|
|
48628
|
+
// ../../../../node_modules/validator/lib/isLuhnNumber.js
|
|
48649
48629
|
var require_isLuhnNumber = __commonJS((exports, module) => {
|
|
48650
48630
|
var _interopRequireDefault = function(obj) {
|
|
48651
48631
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -48683,7 +48663,7 @@ var require_isLuhnNumber = __commonJS((exports, module) => {
|
|
|
48683
48663
|
module.exports.default = exports.default;
|
|
48684
48664
|
});
|
|
48685
48665
|
|
|
48686
|
-
// ../../../../node_modules
|
|
48666
|
+
// ../../../../node_modules/validator/lib/isCreditCard.js
|
|
48687
48667
|
var require_isCreditCard = __commonJS((exports, module) => {
|
|
48688
48668
|
var _interopRequireDefault = function(obj) {
|
|
48689
48669
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -48734,7 +48714,7 @@ var require_isCreditCard = __commonJS((exports, module) => {
|
|
|
48734
48714
|
module.exports.default = exports.default;
|
|
48735
48715
|
});
|
|
48736
48716
|
|
|
48737
|
-
// ../../../../node_modules
|
|
48717
|
+
// ../../../../node_modules/validator/lib/isAlphanumeric.js
|
|
48738
48718
|
var require_isAlphanumeric = __commonJS((exports) => {
|
|
48739
48719
|
var _interopRequireDefault = function(obj) {
|
|
48740
48720
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -48766,11 +48746,10 @@ var require_isAlphanumeric = __commonJS((exports) => {
|
|
|
48766
48746
|
exports.locales = undefined;
|
|
48767
48747
|
var _assertString = _interopRequireDefault(require_assertString());
|
|
48768
48748
|
var _alpha = require_alpha();
|
|
48769
|
-
var locales = Object.keys(_alpha.alphanumeric);
|
|
48770
|
-
exports.locales = locales;
|
|
48749
|
+
var locales = exports.locales = Object.keys(_alpha.alphanumeric);
|
|
48771
48750
|
});
|
|
48772
48751
|
|
|
48773
|
-
// ../../../../node_modules
|
|
48752
|
+
// ../../../../node_modules/validator/lib/isPassportNumber.js
|
|
48774
48753
|
var require_isPassportNumber = __commonJS((exports, module) => {
|
|
48775
48754
|
var _interopRequireDefault = function(obj) {
|
|
48776
48755
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -48790,7 +48769,7 @@ var require_isPassportNumber = __commonJS((exports, module) => {
|
|
|
48790
48769
|
AR: /^[A-Z]{3}\d{6}$/,
|
|
48791
48770
|
AT: /^[A-Z]\d{7}$/,
|
|
48792
48771
|
AU: /^[A-Z]\d{7}$/,
|
|
48793
|
-
AZ: /^[A-Z]{
|
|
48772
|
+
AZ: /^[A-Z]{1}\d{8}$/,
|
|
48794
48773
|
BE: /^[A-Z]{2}\d{6}$/,
|
|
48795
48774
|
BG: /^\d{9}$/,
|
|
48796
48775
|
BR: /^[A-Z]{2}\d{6}$/,
|
|
@@ -48844,13 +48823,14 @@ var require_isPassportNumber = __commonJS((exports, module) => {
|
|
|
48844
48823
|
TH: /^[A-Z]{1,2}\d{6,7}$/,
|
|
48845
48824
|
TR: /^[A-Z]\d{8}$/,
|
|
48846
48825
|
UA: /^[A-Z]{2}\d{6}$/,
|
|
48847
|
-
US: /^\d{9}
|
|
48826
|
+
US: /^\d{9}$/,
|
|
48827
|
+
ZA: /^[TAMD]\d{8}$/
|
|
48848
48828
|
};
|
|
48849
48829
|
module.exports = exports.default;
|
|
48850
48830
|
module.exports.default = exports.default;
|
|
48851
48831
|
});
|
|
48852
48832
|
|
|
48853
|
-
// ../../../../node_modules
|
|
48833
|
+
// ../../../../node_modules/validator/lib/isPostalCode.js
|
|
48854
48834
|
var require_isPostalCode = __commonJS((exports) => {
|
|
48855
48835
|
var _interopRequireDefault = function(obj) {
|
|
48856
48836
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -48928,7 +48908,7 @@ var require_isPostalCode = __commonJS((exports) => {
|
|
|
48928
48908
|
MX: fiveDigit,
|
|
48929
48909
|
MT: /^[A-Za-z]{3}\s{0,1}\d{4}$/,
|
|
48930
48910
|
MY: fiveDigit,
|
|
48931
|
-
NL:
|
|
48911
|
+
NL: /^[1-9]\d{3}\s?(?!sa|sd|ss)[a-z]{2}$/i,
|
|
48932
48912
|
NO: fourDigit,
|
|
48933
48913
|
NP: /^(10|21|22|32|33|34|44|45|56|57)\d{3}$|^(977)$/i,
|
|
48934
48914
|
NZ: fourDigit,
|
|
@@ -48950,11 +48930,10 @@ var require_isPostalCode = __commonJS((exports) => {
|
|
|
48950
48930
|
ZA: fourDigit,
|
|
48951
48931
|
ZM: fiveDigit
|
|
48952
48932
|
};
|
|
48953
|
-
var locales = Object.keys(patterns);
|
|
48954
|
-
exports.locales = locales;
|
|
48933
|
+
var locales = exports.locales = Object.keys(patterns);
|
|
48955
48934
|
});
|
|
48956
48935
|
|
|
48957
|
-
// ../../../../node_modules
|
|
48936
|
+
// ../../../../node_modules/validator/lib/isMobilePhone.js
|
|
48958
48937
|
var require_isMobilePhone = __commonJS((exports) => {
|
|
48959
48938
|
var _interopRequireDefault = function(obj) {
|
|
48960
48939
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -48996,7 +48975,7 @@ var require_isMobilePhone = __commonJS((exports) => {
|
|
|
48996
48975
|
exports.locales = undefined;
|
|
48997
48976
|
var _assertString = _interopRequireDefault(require_assertString());
|
|
48998
48977
|
var phones = {
|
|
48999
|
-
"am-AM": /^(\+?374|0)(
|
|
48978
|
+
"am-AM": /^(\+?374|0)(33|4[134]|55|77|88|9[13-689])\d{6}$/,
|
|
49000
48979
|
"ar-AE": /^((\+?971)|0)?5[024568]\d{7}$/,
|
|
49001
48980
|
"ar-BH": /^(\+?973)?(3|6)\d{7}$/,
|
|
49002
48981
|
"ar-DZ": /^(\+?213|0)(5|6|7)\d{8}$/,
|
|
@@ -49050,6 +49029,7 @@ var require_isMobilePhone = __commonJS((exports) => {
|
|
|
49050
49029
|
"en-LS": /^(\+?266)(22|28|57|58|59|27|52)\d{6}$/,
|
|
49051
49030
|
"en-MT": /^(\+?356|0)?(99|79|77|21|27|22|25)[0-9]{6}$/,
|
|
49052
49031
|
"en-MU": /^(\+?230|0)?\d{8}$/,
|
|
49032
|
+
"en-MW": /^(\+?265|0)(((77|88|31|99|98|21)\d{7})|(((111)|1)\d{6})|(32000\d{4}))$/,
|
|
49053
49033
|
"en-NA": /^(\+?264|0)(6|8)\d{7}$/,
|
|
49054
49034
|
"en-NG": /^(\+?234|0)?[789]\d{9}$/,
|
|
49055
49035
|
"en-NZ": /^(\+?64|0)[28]\d{7,9}$/,
|
|
@@ -49161,8 +49141,7 @@ var require_isMobilePhone = __commonJS((exports) => {
|
|
|
49161
49141
|
phones["ga-IE"] = phones["en-IE"];
|
|
49162
49142
|
phones["fr-CH"] = phones["de-CH"];
|
|
49163
49143
|
phones["it-CH"] = phones["fr-CH"];
|
|
49164
|
-
var locales = Object.keys(phones);
|
|
49165
|
-
exports.locales = locales;
|
|
49144
|
+
var locales = exports.locales = Object.keys(phones);
|
|
49166
49145
|
});
|
|
49167
49146
|
|
|
49168
49147
|
// ../../../../node_modules/dayjs/dayjs.min.js
|
|
@@ -49616,7 +49595,7 @@ var require_customParseFormat = __commonJS((exports, module) => {
|
|
|
49616
49595
|
});
|
|
49617
49596
|
});
|
|
49618
49597
|
|
|
49619
|
-
// ../../../../node_modules
|
|
49598
|
+
// ../../../../node_modules/validator/lib/escape.js
|
|
49620
49599
|
var require_escape = __commonJS((exports, module) => {
|
|
49621
49600
|
var _interopRequireDefault = function(obj) {
|
|
49622
49601
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -49634,7 +49613,7 @@ var require_escape = __commonJS((exports, module) => {
|
|
|
49634
49613
|
module.exports.default = exports.default;
|
|
49635
49614
|
});
|
|
49636
49615
|
|
|
49637
|
-
// ../../../../node_modules
|
|
49616
|
+
// ../../../../node_modules/validator/lib/normalizeEmail.js
|
|
49638
49617
|
var require_normalizeEmail = __commonJS((exports, module) => {
|
|
49639
49618
|
var _interopRequireDefault = function(obj) {
|
|
49640
49619
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
@@ -52701,7 +52680,7 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
52701
52680
|
warnStream.write(util.format.apply(util, args));
|
|
52702
52681
|
}
|
|
52703
52682
|
};
|
|
52704
|
-
var
|
|
52683
|
+
var path15 = import.meta.require("path");
|
|
52705
52684
|
var Stream = import.meta.require("stream").Stream;
|
|
52706
52685
|
var split = require_split2();
|
|
52707
52686
|
var util = import.meta.require("util");
|
|
@@ -52730,7 +52709,7 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
52730
52709
|
};
|
|
52731
52710
|
exports.getFileName = function(rawEnv) {
|
|
52732
52711
|
var env3 = rawEnv || process.env;
|
|
52733
|
-
var file = env3.PGPASSFILE || (isWin ?
|
|
52712
|
+
var file = env3.PGPASSFILE || (isWin ? path15.join(env3.APPDATA || "./", "postgresql", "pgpass.conf") : path15.join(env3.HOME || "./", ".pgpass"));
|
|
52734
52713
|
return file;
|
|
52735
52714
|
};
|
|
52736
52715
|
exports.usePgPass = function(stats, fname) {
|
|
@@ -52854,7 +52833,7 @@ var require_helper = __commonJS((exports, module) => {
|
|
|
52854
52833
|
|
|
52855
52834
|
// ../../../../node_modules/pgpass/lib/index.js
|
|
52856
52835
|
var require_lib15 = __commonJS((exports, module) => {
|
|
52857
|
-
var
|
|
52836
|
+
var path15 = import.meta.require("path");
|
|
52858
52837
|
var fs7 = import.meta.require("fs");
|
|
52859
52838
|
var helper = require_helper();
|
|
52860
52839
|
module.exports = function(connInfo, cb) {
|
|
@@ -54239,7 +54218,7 @@ import {log as log10} from "@stacksjs/cli";
|
|
|
54239
54218
|
import {database as database7} from "@stacksjs/config";
|
|
54240
54219
|
|
|
54241
54220
|
// ../error-handling/src/handler.ts
|
|
54242
|
-
import * as
|
|
54221
|
+
import * as path from "@stacksjs/path";
|
|
54243
54222
|
// ../types/src/cron-jobs.ts
|
|
54244
54223
|
var Every;
|
|
54245
54224
|
(function(Every2) {
|
|
@@ -54493,10 +54472,32 @@ var errAsync = (err) => new ResultAsync(Promise.resolve(new Err(err)));
|
|
|
54493
54472
|
var fromPromise = ResultAsync.fromPromise;
|
|
54494
54473
|
var fromSafePromise = ResultAsync.fromSafePromise;
|
|
54495
54474
|
var fromAsyncThrowable = ResultAsync.fromThrowable;
|
|
54496
|
-
var
|
|
54497
|
-
|
|
54475
|
+
var combineResultList = (resultList) => {
|
|
54476
|
+
let acc = ok([]);
|
|
54477
|
+
for (const result of resultList) {
|
|
54478
|
+
if (result.isErr()) {
|
|
54479
|
+
acc = err(result.error);
|
|
54480
|
+
break;
|
|
54481
|
+
} else {
|
|
54482
|
+
acc.map((list) => list.push(result.value));
|
|
54483
|
+
}
|
|
54484
|
+
}
|
|
54485
|
+
return acc;
|
|
54486
|
+
};
|
|
54498
54487
|
var combineResultAsyncList = (asyncResultList) => ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultList);
|
|
54499
|
-
var combineResultListWithAllErrors = (resultList) =>
|
|
54488
|
+
var combineResultListWithAllErrors = (resultList) => {
|
|
54489
|
+
let acc = ok([]);
|
|
54490
|
+
for (const result of resultList) {
|
|
54491
|
+
if (result.isErr() && acc.isErr()) {
|
|
54492
|
+
acc.error.push(result.error);
|
|
54493
|
+
} else if (result.isErr() && acc.isOk()) {
|
|
54494
|
+
acc = err([result.error]);
|
|
54495
|
+
} else if (result.isOk() && acc.isOk()) {
|
|
54496
|
+
acc.value.push(result.value);
|
|
54497
|
+
}
|
|
54498
|
+
}
|
|
54499
|
+
return acc;
|
|
54500
|
+
};
|
|
54500
54501
|
var combineResultAsyncListWithAllErrors = (asyncResultList) => ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultListWithAllErrors);
|
|
54501
54502
|
var Result;
|
|
54502
54503
|
(function(Result2) {
|
|
@@ -54631,6 +54632,7 @@ var import_traverse = __toESM(require_lib14(), 1);
|
|
|
54631
54632
|
var import_generator = __toESM(require_lib7(), 1);
|
|
54632
54633
|
// ../orm/src/utils.ts
|
|
54633
54634
|
import {fs as fs2} from "@stacksjs/storage";
|
|
54635
|
+
import {path as path4} from "@stacksjs/path";
|
|
54634
54636
|
import {plural, snakeCase} from "@stacksjs/strings";
|
|
54635
54637
|
async function modelTableName(model2) {
|
|
54636
54638
|
if (typeof model2 === "string") {
|
|
@@ -54638,6 +54640,17 @@ async function modelTableName(model2) {
|
|
|
54638
54640
|
}
|
|
54639
54641
|
return model2.table ?? snakeCase(plural(model2?.name || ""));
|
|
54640
54642
|
}
|
|
54643
|
+
function getModelName(model2, modelPath) {
|
|
54644
|
+
if (model2.name)
|
|
54645
|
+
return model2.name;
|
|
54646
|
+
const baseName = path4.basename(modelPath);
|
|
54647
|
+
return baseName.replace(/\.ts$/, "");
|
|
54648
|
+
}
|
|
54649
|
+
function getTableName(model2, modelPath) {
|
|
54650
|
+
if (model2.table)
|
|
54651
|
+
return model2.table;
|
|
54652
|
+
return snakeCase(plural(getModelName(model2, modelPath)));
|
|
54653
|
+
}
|
|
54641
54654
|
async function extractFieldsFromModel(filePath) {
|
|
54642
54655
|
const content = fs2.readFileSync(filePath, "utf8");
|
|
54643
54656
|
const ast = import_parser.default.parse(content, {
|
|
@@ -54646,26 +54659,26 @@ async function extractFieldsFromModel(filePath) {
|
|
|
54646
54659
|
});
|
|
54647
54660
|
let fields;
|
|
54648
54661
|
import_traverse.default(ast, {
|
|
54649
|
-
ObjectExpression(
|
|
54650
|
-
const fieldsProperty =
|
|
54662
|
+
ObjectExpression(path5) {
|
|
54663
|
+
const fieldsProperty = path5.node.properties.find((property) => property.key?.name === "attributes");
|
|
54651
54664
|
if (fieldsProperty?.value) {
|
|
54652
54665
|
const generated = import_generator.default(fieldsProperty.value, {}, content);
|
|
54653
54666
|
fields = generated.code;
|
|
54654
|
-
|
|
54667
|
+
path5.stop();
|
|
54655
54668
|
}
|
|
54656
54669
|
}
|
|
54657
54670
|
});
|
|
54658
54671
|
return fields;
|
|
54659
54672
|
}
|
|
54660
54673
|
// src/migrations.ts
|
|
54661
|
-
import {path as
|
|
54674
|
+
import {path as path16} from "@stacksjs/path";
|
|
54662
54675
|
import {fs as fs7, glob as glob6} from "@stacksjs/storage";
|
|
54663
54676
|
var {$: $2 } = globalThis.Bun;
|
|
54664
54677
|
import {FileMigrationProvider, Migrator} from "kysely";
|
|
54665
54678
|
|
|
54666
54679
|
// src/drivers/index.ts
|
|
54667
54680
|
import {log as log8} from "@stacksjs/cli";
|
|
54668
|
-
import {path as
|
|
54681
|
+
import {path as path14} from "@stacksjs/path";
|
|
54669
54682
|
import {fs as fs6, glob as glob5} from "@stacksjs/storage";
|
|
54670
54683
|
import {plural as plural2, snakeCase as snakeCase2} from "@stacksjs/strings";
|
|
54671
54684
|
|
|
@@ -54813,7 +54826,7 @@ var dinero = createDinero({
|
|
|
54813
54826
|
}
|
|
54814
54827
|
});
|
|
54815
54828
|
|
|
54816
|
-
// ../../../../node_modules/@vinejs/vine/build/chunk-
|
|
54829
|
+
// ../../../../node_modules/@vinejs/vine/build/chunk-577THMJC.js
|
|
54817
54830
|
var messages = {
|
|
54818
54831
|
required: "The {{ field }} field must be defined",
|
|
54819
54832
|
string: "The {{ field }} field must be a string",
|
|
@@ -54846,6 +54859,7 @@ var messages = {
|
|
|
54846
54859
|
hexCode: "The {{ field }} field must be a valid hex color code",
|
|
54847
54860
|
boolean: "The value must be a boolean",
|
|
54848
54861
|
number: "The {{ field }} field must be a number",
|
|
54862
|
+
"number.in": "The selected {{ field }} is not in {{ values }}",
|
|
54849
54863
|
min: "The {{ field }} field must be at least {{ min }}",
|
|
54850
54864
|
max: "The {{ field }} field must not be greater than {{ max }}",
|
|
54851
54865
|
range: "The {{ field }} field must be between {{ min }} and {{ max }}",
|
|
@@ -54904,7 +54918,7 @@ function dlv_es_default(t, e, l2, n, r2) {
|
|
|
54904
54918
|
return t === r2 ? l2 : t;
|
|
54905
54919
|
}
|
|
54906
54920
|
|
|
54907
|
-
// ../../../../node_modules/@vinejs/vine/build/chunk-
|
|
54921
|
+
// ../../../../node_modules/@vinejs/vine/build/chunk-2W32DW3L.js
|
|
54908
54922
|
var isIP = __toESM(require_isIP(), 1);
|
|
54909
54923
|
var isJWT = __toESM(require_isJWT(), 1);
|
|
54910
54924
|
var isURL = __toESM(require_isURL(), 1);
|
|
@@ -55206,7 +55220,7 @@ var helpers2 = {
|
|
|
55206
55220
|
}
|
|
55207
55221
|
};
|
|
55208
55222
|
|
|
55209
|
-
// ../../../../node_modules/@vinejs/vine/build/chunk-
|
|
55223
|
+
// ../../../../node_modules/@vinejs/vine/build/chunk-46WINKKP.js
|
|
55210
55224
|
var createRule = function(validator, metaData) {
|
|
55211
55225
|
const rule = {
|
|
55212
55226
|
validator,
|
|
@@ -55328,7 +55342,7 @@ function camelCase(input, options) {
|
|
|
55328
55342
|
return postProcess(input, toUpperCase);
|
|
55329
55343
|
}
|
|
55330
55344
|
|
|
55331
|
-
// ../../../../node_modules/@vinejs/vine/build/chunk-
|
|
55345
|
+
// ../../../../node_modules/@vinejs/vine/build/chunk-46WINKKP.js
|
|
55332
55346
|
var import_dayjs = __toESM(require_dayjs_min(), 1);
|
|
55333
55347
|
var import_dayjs2 = __toESM(require_dayjs_min(), 1);
|
|
55334
55348
|
var isSameOrAfter = __toESM(require_isSameOrAfter(), 1);
|
|
@@ -55532,7 +55546,7 @@ function normalizeUrl(urlString, options) {
|
|
|
55532
55546
|
return urlString;
|
|
55533
55547
|
}
|
|
55534
55548
|
|
|
55535
|
-
// ../../../../node_modules/@vinejs/vine/build/chunk-
|
|
55549
|
+
// ../../../../node_modules/@vinejs/vine/build/chunk-46WINKKP.js
|
|
55536
55550
|
var escape = __toESM(require_escape(), 1);
|
|
55537
55551
|
var normalizeEmail = __toESM(require_normalizeEmail(), 1);
|
|
55538
55552
|
var group = function(conditionals) {
|
|
@@ -56397,7 +56411,7 @@ var Compiler = class {
|
|
|
56397
56411
|
}
|
|
56398
56412
|
};
|
|
56399
56413
|
|
|
56400
|
-
// ../../../../node_modules/@vinejs/vine/build/chunk-
|
|
56414
|
+
// ../../../../node_modules/@vinejs/vine/build/chunk-46WINKKP.js
|
|
56401
56415
|
var symbols_exports = {};
|
|
56402
56416
|
__export2(symbols_exports, {
|
|
56403
56417
|
COTYPE: () => COTYPE,
|
|
@@ -57961,8 +57975,17 @@ var withoutDecimalsRule = createRule((value, _2, field) => {
|
|
|
57961
57975
|
field.report(messages.withoutDecimals, "withoutDecimals", field);
|
|
57962
57976
|
}
|
|
57963
57977
|
});
|
|
57978
|
+
var inRule2 = createRule((value, options, field) => {
|
|
57979
|
+
if (!field.isValid) {
|
|
57980
|
+
return;
|
|
57981
|
+
}
|
|
57982
|
+
if (!options.values.includes(value)) {
|
|
57983
|
+
field.report(messages["number.in"], "in", field, options);
|
|
57984
|
+
}
|
|
57985
|
+
});
|
|
57964
57986
|
var VineNumber = class _VineNumber extends BaseLiteralType {
|
|
57965
57987
|
static rules = {
|
|
57988
|
+
in: inRule2,
|
|
57966
57989
|
max: maxRule,
|
|
57967
57990
|
min: minRule,
|
|
57968
57991
|
range: rangeRule,
|
|
@@ -58004,6 +58027,9 @@ var VineNumber = class _VineNumber extends BaseLiteralType {
|
|
|
58004
58027
|
clone() {
|
|
58005
58028
|
return new _VineNumber(this.cloneOptions(), this.cloneValidations());
|
|
58006
58029
|
}
|
|
58030
|
+
in(values) {
|
|
58031
|
+
return this.use(inRule2({ values }));
|
|
58032
|
+
}
|
|
58007
58033
|
};
|
|
58008
58034
|
var booleanRule = createRule((value, options, field) => {
|
|
58009
58035
|
const valueAsBoolean = options.strict === true ? value : helpers2.asBoolean(value);
|
|
@@ -58233,6 +58259,7 @@ var COMPILER_ERROR_MESSAGES = {
|
|
|
58233
58259
|
object: messages.object
|
|
58234
58260
|
};
|
|
58235
58261
|
var VineValidator = class {
|
|
58262
|
+
#compiled;
|
|
58236
58263
|
messagesProvider;
|
|
58237
58264
|
errorReporter;
|
|
58238
58265
|
#parse(schema) {
|
|
@@ -58247,6 +58274,7 @@ var VineValidator = class {
|
|
|
58247
58274
|
}
|
|
58248
58275
|
constructor(schema, options) {
|
|
58249
58276
|
const { compilerNode, refs } = this.#parse(schema);
|
|
58277
|
+
this.#compiled = { schema: compilerNode, refs };
|
|
58250
58278
|
const metaDataValidator = options.metaDataValidator;
|
|
58251
58279
|
const validateFn = new Compiler(compilerNode, {
|
|
58252
58280
|
convertEmptyStringsToNull: options.convertEmptyStringsToNull,
|
|
@@ -58273,6 +58301,24 @@ var VineValidator = class {
|
|
|
58273
58301
|
};
|
|
58274
58302
|
}
|
|
58275
58303
|
}
|
|
58304
|
+
async tryValidate(data, ...[options]) {
|
|
58305
|
+
try {
|
|
58306
|
+
const result = await this.validate(data, options);
|
|
58307
|
+
return [null, result];
|
|
58308
|
+
} catch (error) {
|
|
58309
|
+
if (error instanceof ValidationError) {
|
|
58310
|
+
return [error, null];
|
|
58311
|
+
}
|
|
58312
|
+
throw error;
|
|
58313
|
+
}
|
|
58314
|
+
}
|
|
58315
|
+
toJSON() {
|
|
58316
|
+
const { schema, refs } = this.#compiled;
|
|
58317
|
+
return {
|
|
58318
|
+
schema: structuredClone(schema),
|
|
58319
|
+
refs
|
|
58320
|
+
};
|
|
58321
|
+
}
|
|
58276
58322
|
};
|
|
58277
58323
|
var Vine = class extends SchemaBuilder {
|
|
58278
58324
|
messagesProvider = new SimpleMessagesProvider(messages, fields);
|
|
@@ -58303,6 +58349,10 @@ var Vine = class extends SchemaBuilder {
|
|
|
58303
58349
|
const validator = this.compile(options.schema);
|
|
58304
58350
|
return validator.validate(options.data, options);
|
|
58305
58351
|
}
|
|
58352
|
+
tryValidate(options) {
|
|
58353
|
+
const validator = this.compile(options.schema);
|
|
58354
|
+
return validator.tryValidate(options.data, options);
|
|
58355
|
+
}
|
|
58306
58356
|
};
|
|
58307
58357
|
var vine = new Vine;
|
|
58308
58358
|
var vine_default = vine;
|
|
@@ -58331,10 +58381,10 @@ var isMoney = vine_default.createRule((value, _2, field) => {
|
|
|
58331
58381
|
});
|
|
58332
58382
|
// ../validation/src/validator.ts
|
|
58333
58383
|
import {log as log4} from "@stacksjs/cli";
|
|
58334
|
-
import {path as
|
|
58384
|
+
import {path as path6} from "@stacksjs/path";
|
|
58335
58385
|
// src/drivers/mysql.ts
|
|
58336
58386
|
import {italic as italic2, log as log5} from "@stacksjs/cli";
|
|
58337
|
-
import {path as
|
|
58387
|
+
import {path as path8} from "@stacksjs/path";
|
|
58338
58388
|
import {fs as fs3, glob as glob2} from "@stacksjs/storage";
|
|
58339
58389
|
async function resetMysqlDatabase() {
|
|
58340
58390
|
const tables2 = await fetchMysqlTables();
|
|
@@ -58342,19 +58392,19 @@ async function resetMysqlDatabase() {
|
|
|
58342
58392
|
await db.schema.dropTable(table2).ifExists().execute();
|
|
58343
58393
|
await db.schema.dropTable("migrations").ifExists().execute();
|
|
58344
58394
|
await db.schema.dropTable("migration_locks").ifExists().execute();
|
|
58345
|
-
const files = await fs3.readdir(
|
|
58346
|
-
const modelFiles = await fs3.readdir(
|
|
58347
|
-
const userModelFiles = glob2.sync(
|
|
58395
|
+
const files = await fs3.readdir(path8.userMigrationsPath());
|
|
58396
|
+
const modelFiles = await fs3.readdir(path8.frameworkPath("database/models"));
|
|
58397
|
+
const userModelFiles = glob2.sync(path8.userModelsPath("*.ts"));
|
|
58348
58398
|
for (const userModel of userModelFiles) {
|
|
58349
58399
|
const model2 = (await import(userModel)).default;
|
|
58350
|
-
const pivotTables = await getPivotTables(model2);
|
|
58400
|
+
const pivotTables = await getPivotTables(model2, userModel);
|
|
58351
58401
|
for (const pivotTable of pivotTables)
|
|
58352
58402
|
await db.schema.dropTable(pivotTable.table).ifExists().execute();
|
|
58353
58403
|
}
|
|
58354
58404
|
if (modelFiles.length) {
|
|
58355
58405
|
for (const modelFile of modelFiles) {
|
|
58356
58406
|
if (modelFile.endsWith(".ts")) {
|
|
58357
|
-
const modelPath =
|
|
58407
|
+
const modelPath = path8.frameworkPath(`database/models/${modelFile}`);
|
|
58358
58408
|
if (fs3.existsSync(modelPath))
|
|
58359
58409
|
await Bun.$`rm ${modelPath}`;
|
|
58360
58410
|
}
|
|
@@ -58363,7 +58413,7 @@ async function resetMysqlDatabase() {
|
|
|
58363
58413
|
if (files.length) {
|
|
58364
58414
|
for (const file of files) {
|
|
58365
58415
|
if (file.endsWith(".ts")) {
|
|
58366
|
-
const migrationPath =
|
|
58416
|
+
const migrationPath = path8.userMigrationsPath(`${file}`);
|
|
58367
58417
|
if (fs3.existsSync(migrationPath))
|
|
58368
58418
|
await Bun.$`rm ${migrationPath}`;
|
|
58369
58419
|
}
|
|
@@ -58372,23 +58422,23 @@ async function resetMysqlDatabase() {
|
|
|
58372
58422
|
return ok("All tables dropped successfully!");
|
|
58373
58423
|
}
|
|
58374
58424
|
async function generateMysqlMigration(modelPath) {
|
|
58375
|
-
const files = await fs3.readdir(
|
|
58425
|
+
const files = await fs3.readdir(path8.userMigrationsPath());
|
|
58376
58426
|
if (files.length === 0) {
|
|
58377
58427
|
log5.debug("No migrations found in the database folder, deleting all framework/database/*.json files...");
|
|
58378
|
-
const modelFiles = await fs3.readdir(
|
|
58428
|
+
const modelFiles = await fs3.readdir(path8.frameworkPath("database/models"));
|
|
58379
58429
|
if (modelFiles.length) {
|
|
58380
58430
|
log5.debug("No existing model files in framework path...");
|
|
58381
58431
|
for (const file of modelFiles) {
|
|
58382
58432
|
if (file.endsWith(".ts"))
|
|
58383
|
-
await fs3.unlink(
|
|
58433
|
+
await fs3.unlink(path8.frameworkPath(`database/models/${file}`));
|
|
58384
58434
|
}
|
|
58385
58435
|
}
|
|
58386
58436
|
}
|
|
58387
58437
|
const model2 = (await import(modelPath)).default;
|
|
58388
|
-
const fileName =
|
|
58389
|
-
const tableName = await
|
|
58438
|
+
const fileName = path8.basename(modelPath);
|
|
58439
|
+
const tableName = await getTableName(model2, modelPath);
|
|
58390
58440
|
const fieldsString = JSON.stringify(model2.attributes, null, 2);
|
|
58391
|
-
const copiedModelPath =
|
|
58441
|
+
const copiedModelPath = path8.frameworkPath(`database/models/${fileName}`);
|
|
58392
58442
|
let haveFieldsChanged = false;
|
|
58393
58443
|
if (fs3.existsSync(copiedModelPath)) {
|
|
58394
58444
|
log5.info(`Fields have already been generated for ${tableName}`);
|
|
@@ -58414,9 +58464,9 @@ async function generateMysqlMigration(modelPath) {
|
|
|
58414
58464
|
async function createTableMigration(modelPath) {
|
|
58415
58465
|
log5.debug("createTableMigration modelPath:", modelPath);
|
|
58416
58466
|
const model2 = (await import(modelPath)).default;
|
|
58417
|
-
const tableName = await
|
|
58418
|
-
await createPivotTableMigration(model2);
|
|
58419
|
-
const otherModelRelations = await fetchOtherModelRelations(model2);
|
|
58467
|
+
const tableName = await getTableName(model2, modelPath);
|
|
58468
|
+
await createPivotTableMigration(model2, modelPath);
|
|
58469
|
+
const otherModelRelations = await fetchOtherModelRelations(model2, modelPath);
|
|
58420
58470
|
const fields2 = model2.attributes;
|
|
58421
58471
|
const useTimestamps = model2?.traits?.useTimestamps ?? model2?.traits?.timestampable ?? true;
|
|
58422
58472
|
const useSoftDeletes = model2?.traits?.useSoftDeletes ?? model2?.traits?.softDeletable ?? false;
|
|
@@ -58457,12 +58507,12 @@ async function createTableMigration(modelPath) {
|
|
|
58457
58507
|
migrationContent += `}\n`;
|
|
58458
58508
|
const timestamp = new Date().getTime().toString();
|
|
58459
58509
|
const migrationFileName = `${timestamp}-create-${tableName}-table.ts`;
|
|
58460
|
-
const migrationFilePath =
|
|
58510
|
+
const migrationFilePath = path8.userMigrationsPath(migrationFileName);
|
|
58461
58511
|
Bun.write(migrationFilePath, migrationContent);
|
|
58462
58512
|
log5.success(`Created migration: ${italic2(migrationFileName)}`);
|
|
58463
58513
|
}
|
|
58464
|
-
async function createPivotTableMigration(model2) {
|
|
58465
|
-
const pivotTables = await getPivotTables(model2);
|
|
58514
|
+
async function createPivotTableMigration(model2, modelPath) {
|
|
58515
|
+
const pivotTables = await getPivotTables(model2, modelPath);
|
|
58466
58516
|
if (!pivotTables.length)
|
|
58467
58517
|
return;
|
|
58468
58518
|
for (const pivotTable of pivotTables) {
|
|
@@ -58480,7 +58530,7 @@ async function createPivotTableMigration(model2) {
|
|
|
58480
58530
|
migrationContent += ` }\n`;
|
|
58481
58531
|
const timestamp = new Date().getTime().toString();
|
|
58482
58532
|
const migrationFileName = `${timestamp}-create-${pivotTable.table}-table.ts`;
|
|
58483
|
-
const migrationFilePath =
|
|
58533
|
+
const migrationFilePath = path8.userMigrationsPath(migrationFileName);
|
|
58484
58534
|
Bun.write(migrationFilePath, migrationContent);
|
|
58485
58535
|
log5.success(`Created pivot migration: ${migrationFileName}`);
|
|
58486
58536
|
}
|
|
@@ -58488,8 +58538,8 @@ async function createPivotTableMigration(model2) {
|
|
|
58488
58538
|
async function createAlterTableMigration(modelPath) {
|
|
58489
58539
|
console.log("createAlterTableMigration");
|
|
58490
58540
|
const model2 = (await import(modelPath)).default;
|
|
58491
|
-
const modelName =
|
|
58492
|
-
const tableName = await
|
|
58541
|
+
const modelName = getModelName(model2, modelPath);
|
|
58542
|
+
const tableName = await getTableName(model2, modelPath);
|
|
58493
58543
|
const lastMigrationFields = await getLastMigrationFields(modelName);
|
|
58494
58544
|
const lastFields = lastMigrationFields ?? {};
|
|
58495
58545
|
const currentFields = model2.attributes;
|
|
@@ -58510,23 +58560,23 @@ async function createAlterTableMigration(modelPath) {
|
|
|
58510
58560
|
migrationContent += `}\n`;
|
|
58511
58561
|
const timestamp = new Date().getTime().toString();
|
|
58512
58562
|
const migrationFileName = `${timestamp}-update-${tableName}-table.ts`;
|
|
58513
|
-
const migrationFilePath =
|
|
58563
|
+
const migrationFilePath = path8.userMigrationsPath(migrationFileName);
|
|
58514
58564
|
Bun.write(migrationFilePath, migrationContent);
|
|
58515
58565
|
log5.success(`Created migration: ${italic2(migrationFileName)}`);
|
|
58516
58566
|
}
|
|
58517
58567
|
async function fetchMysqlTables() {
|
|
58518
|
-
const modelFiles = glob2.sync(
|
|
58568
|
+
const modelFiles = glob2.sync(path8.userModelsPath("*.ts"));
|
|
58519
58569
|
const tables2 = [];
|
|
58520
58570
|
for (const modelPath of modelFiles) {
|
|
58521
58571
|
const model2 = (await import(modelPath)).default;
|
|
58522
|
-
const tableName = await
|
|
58572
|
+
const tableName = await getTableName(model2, modelPath);
|
|
58523
58573
|
tables2.push(tableName);
|
|
58524
58574
|
}
|
|
58525
58575
|
return tables2;
|
|
58526
58576
|
}
|
|
58527
58577
|
// src/drivers/postgres.ts
|
|
58528
58578
|
import {italic as italic3, log as log6} from "@stacksjs/cli";
|
|
58529
|
-
import {path as
|
|
58579
|
+
import {path as path10} from "@stacksjs/path";
|
|
58530
58580
|
import {fs as fs4, glob as glob3} from "@stacksjs/storage";
|
|
58531
58581
|
async function resetPostgresDatabase() {
|
|
58532
58582
|
const tables2 = await fetchMysqlTables2();
|
|
@@ -58534,19 +58584,19 @@ async function resetPostgresDatabase() {
|
|
|
58534
58584
|
await db.schema.dropTable(table2).ifExists().execute();
|
|
58535
58585
|
await db.schema.dropTable("migrations").ifExists().execute();
|
|
58536
58586
|
await db.schema.dropTable("migration_locks").ifExists().execute();
|
|
58537
|
-
const files = await fs4.readdir(
|
|
58538
|
-
const modelFiles = await fs4.readdir(
|
|
58539
|
-
const userModelFiles = glob3.sync(
|
|
58587
|
+
const files = await fs4.readdir(path10.userMigrationsPath());
|
|
58588
|
+
const modelFiles = await fs4.readdir(path10.frameworkPath("database/models"));
|
|
58589
|
+
const userModelFiles = glob3.sync(path10.userModelsPath("*.ts"));
|
|
58540
58590
|
for (const userModel of userModelFiles) {
|
|
58541
|
-
const userModelPath = await import(userModel);
|
|
58542
|
-
const pivotTables = await getPivotTables(userModelPath);
|
|
58591
|
+
const userModelPath = (await import(userModel)).default;
|
|
58592
|
+
const pivotTables = await getPivotTables(userModelPath, userModelPath);
|
|
58543
58593
|
for (const pivotTable of pivotTables)
|
|
58544
58594
|
await db.schema.dropTable(pivotTable.table).ifExists().execute();
|
|
58545
58595
|
}
|
|
58546
58596
|
if (modelFiles.length) {
|
|
58547
58597
|
for (const modelFile of modelFiles) {
|
|
58548
58598
|
if (modelFile.endsWith(".ts")) {
|
|
58549
|
-
const modelPath =
|
|
58599
|
+
const modelPath = path10.frameworkPath(`database/models/${modelFile}`);
|
|
58550
58600
|
if (fs4.existsSync(modelPath))
|
|
58551
58601
|
await Bun.$`rm ${modelPath}`;
|
|
58552
58602
|
}
|
|
@@ -58555,7 +58605,7 @@ async function resetPostgresDatabase() {
|
|
|
58555
58605
|
if (files.length) {
|
|
58556
58606
|
for (const file of files) {
|
|
58557
58607
|
if (file.endsWith(".ts")) {
|
|
58558
|
-
const migrationPath =
|
|
58608
|
+
const migrationPath = path10.userMigrationsPath(`${file}`);
|
|
58559
58609
|
if (fs4.existsSync(migrationPath))
|
|
58560
58610
|
await Bun.$`rm ${migrationPath}`;
|
|
58561
58611
|
}
|
|
@@ -58564,23 +58614,23 @@ async function resetPostgresDatabase() {
|
|
|
58564
58614
|
return ok("All tables dropped successfully!");
|
|
58565
58615
|
}
|
|
58566
58616
|
async function generatePostgresMigration(modelPath) {
|
|
58567
|
-
const files = await fs4.readdir(
|
|
58617
|
+
const files = await fs4.readdir(path10.userMigrationsPath());
|
|
58568
58618
|
if (files.length === 0) {
|
|
58569
58619
|
log6.debug("No migrations found in the database folder, deleting all framework/database/*.json files...");
|
|
58570
|
-
const modelFiles = await fs4.readdir(
|
|
58620
|
+
const modelFiles = await fs4.readdir(path10.frameworkPath("database/models"));
|
|
58571
58621
|
if (modelFiles.length) {
|
|
58572
58622
|
log6.debug("No existing model files in framework path...");
|
|
58573
58623
|
for (const file of modelFiles) {
|
|
58574
58624
|
if (file.endsWith(".ts"))
|
|
58575
|
-
await fs4.unlink(
|
|
58625
|
+
await fs4.unlink(path10.frameworkPath(`database/models/${file}`));
|
|
58576
58626
|
}
|
|
58577
58627
|
}
|
|
58578
58628
|
}
|
|
58579
58629
|
const model2 = (await import(modelPath)).default;
|
|
58580
|
-
const fileName =
|
|
58581
|
-
const tableName =
|
|
58630
|
+
const fileName = path10.basename(modelPath);
|
|
58631
|
+
const tableName = getTableName(model2, modelPath);
|
|
58582
58632
|
const fieldsString = JSON.stringify(model2.attributes, null, 2);
|
|
58583
|
-
const copiedModelPath =
|
|
58633
|
+
const copiedModelPath = path10.frameworkPath(`database/models/${fileName}`);
|
|
58584
58634
|
let haveFieldsChanged = false;
|
|
58585
58635
|
if (fs4.existsSync(copiedModelPath)) {
|
|
58586
58636
|
log6.info(`Fields have already been generated for ${tableName}`);
|
|
@@ -58606,9 +58656,9 @@ async function generatePostgresMigration(modelPath) {
|
|
|
58606
58656
|
async function createTableMigration2(modelPath) {
|
|
58607
58657
|
log6.debug("createTableMigration modelPath:", modelPath);
|
|
58608
58658
|
const model2 = (await import(modelPath)).default;
|
|
58609
|
-
const tableName =
|
|
58610
|
-
await createPivotTableMigration2(model2);
|
|
58611
|
-
const otherModelRelations = await fetchOtherModelRelations(model2);
|
|
58659
|
+
const tableName = getTableName(model2, modelPath);
|
|
58660
|
+
await createPivotTableMigration2(model2, modelPath);
|
|
58661
|
+
const otherModelRelations = await fetchOtherModelRelations(model2, modelPath);
|
|
58612
58662
|
const fields2 = model2.attributes;
|
|
58613
58663
|
const useTimestamps = model2.traits?.useTimestamps ?? model2.traits?.timestampable ?? true;
|
|
58614
58664
|
const useSoftDeletes = model2.traits?.useSoftDeletes ?? model2.traits?.softDeletable ?? false;
|
|
@@ -58649,12 +58699,12 @@ async function createTableMigration2(modelPath) {
|
|
|
58649
58699
|
migrationContent += `}\n`;
|
|
58650
58700
|
const timestamp = new Date().getTime().toString();
|
|
58651
58701
|
const migrationFileName = `${timestamp}-create-${tableName}-table.ts`;
|
|
58652
|
-
const migrationFilePath =
|
|
58702
|
+
const migrationFilePath = path10.userMigrationsPath(migrationFileName);
|
|
58653
58703
|
Bun.write(migrationFilePath, migrationContent);
|
|
58654
58704
|
log6.success(`Created migration: ${italic3(migrationFileName)}`);
|
|
58655
58705
|
}
|
|
58656
|
-
async function createPivotTableMigration2(model2) {
|
|
58657
|
-
const pivotTables = await getPivotTables(model2);
|
|
58706
|
+
async function createPivotTableMigration2(model2, modelPath) {
|
|
58707
|
+
const pivotTables = await getPivotTables(model2, modelPath);
|
|
58658
58708
|
if (!pivotTables.length)
|
|
58659
58709
|
return;
|
|
58660
58710
|
for (const pivotTable of pivotTables) {
|
|
@@ -58673,7 +58723,7 @@ async function createPivotTableMigration2(model2) {
|
|
|
58673
58723
|
migrationContent += ` }\n`;
|
|
58674
58724
|
const timestamp = new Date().getTime().toString();
|
|
58675
58725
|
const migrationFileName = `${timestamp}-create-${pivotTable.table}-table.ts`;
|
|
58676
|
-
const migrationFilePath =
|
|
58726
|
+
const migrationFilePath = path10.userMigrationsPath(migrationFileName);
|
|
58677
58727
|
Bun.write(migrationFilePath, migrationContent);
|
|
58678
58728
|
log6.success(`Created migration: ${italic3(migrationFileName)}`);
|
|
58679
58729
|
}
|
|
@@ -58681,8 +58731,8 @@ async function createPivotTableMigration2(model2) {
|
|
|
58681
58731
|
async function createAlterTableMigration2(modelPath) {
|
|
58682
58732
|
console.log("createAlterTableMigration");
|
|
58683
58733
|
const model2 = (await import(modelPath)).default;
|
|
58684
|
-
const modelName =
|
|
58685
|
-
const tableName = await
|
|
58734
|
+
const modelName = path10.basename(modelPath);
|
|
58735
|
+
const tableName = await getTableName(model2, modelPath);
|
|
58686
58736
|
const lastMigrationFields = await getLastMigrationFields(modelName);
|
|
58687
58737
|
const lastFields = lastMigrationFields ?? {};
|
|
58688
58738
|
const currentFields = model2.attributes;
|
|
@@ -58703,41 +58753,41 @@ async function createAlterTableMigration2(modelPath) {
|
|
|
58703
58753
|
migrationContent += `}\n`;
|
|
58704
58754
|
const timestamp = new Date().getTime().toString();
|
|
58705
58755
|
const migrationFileName = `${timestamp}-update-${tableName}-table.ts`;
|
|
58706
|
-
const migrationFilePath =
|
|
58756
|
+
const migrationFilePath = path10.userMigrationsPath(migrationFileName);
|
|
58707
58757
|
Bun.write(migrationFilePath, migrationContent);
|
|
58708
58758
|
log6.success(`Created migration: ${italic3(migrationFileName)}`);
|
|
58709
58759
|
}
|
|
58710
58760
|
async function fetchMysqlTables2() {
|
|
58711
|
-
const modelFiles = glob3.sync(
|
|
58761
|
+
const modelFiles = glob3.sync(path10.userModelsPath("*.ts"));
|
|
58712
58762
|
const tables2 = [];
|
|
58713
58763
|
for (const modelPath of modelFiles) {
|
|
58714
|
-
const model2 = await import(modelPath);
|
|
58715
|
-
const tableName = await
|
|
58764
|
+
const model2 = (await import(modelPath)).default;
|
|
58765
|
+
const tableName = await getTableName(model2, modelPath);
|
|
58716
58766
|
tables2.push(tableName);
|
|
58717
58767
|
}
|
|
58718
58768
|
return tables2;
|
|
58719
58769
|
}
|
|
58720
58770
|
// src/drivers/sqlite.ts
|
|
58721
58771
|
import {italic as italic4, log as log7} from "@stacksjs/cli";
|
|
58722
|
-
import {path as
|
|
58772
|
+
import {path as path12} from "@stacksjs/path";
|
|
58723
58773
|
import {fs as fs5, glob as glob4} from "@stacksjs/storage";
|
|
58724
58774
|
async function resetSqliteDatabase() {
|
|
58725
|
-
const dbPath =
|
|
58775
|
+
const dbPath = path12.userDatabasePath("stacks.sqlite");
|
|
58726
58776
|
if (fs5.existsSync(dbPath))
|
|
58727
58777
|
await Bun.$`rm ${dbPath}`;
|
|
58728
|
-
const files = await fs5.readdir(
|
|
58729
|
-
const modelFiles = await fs5.readdir(
|
|
58730
|
-
const userModelFiles = glob4.sync(
|
|
58778
|
+
const files = await fs5.readdir(path12.userMigrationsPath());
|
|
58779
|
+
const modelFiles = await fs5.readdir(path12.frameworkPath("database/models"));
|
|
58780
|
+
const userModelFiles = glob4.sync(path12.userModelsPath("*.ts"));
|
|
58731
58781
|
for (const userModel of userModelFiles) {
|
|
58732
|
-
const userModelPath = await import(userModel);
|
|
58733
|
-
const pivotTables = await getPivotTables(userModelPath);
|
|
58782
|
+
const userModelPath = (await import(userModel)).default;
|
|
58783
|
+
const pivotTables = await getPivotTables(userModelPath, userModel);
|
|
58734
58784
|
for (const pivotTable of pivotTables)
|
|
58735
58785
|
await db.schema.dropTable(pivotTable.table).ifExists().execute();
|
|
58736
58786
|
}
|
|
58737
58787
|
if (modelFiles.length) {
|
|
58738
58788
|
for (const modelFile of modelFiles) {
|
|
58739
58789
|
if (modelFile.endsWith(".ts")) {
|
|
58740
|
-
const modelPath =
|
|
58790
|
+
const modelPath = path12.frameworkPath(`database/models/${modelFile}`);
|
|
58741
58791
|
if (fs5.existsSync(modelPath))
|
|
58742
58792
|
await Bun.$`rm ${modelPath}`;
|
|
58743
58793
|
}
|
|
@@ -58746,7 +58796,7 @@ async function resetSqliteDatabase() {
|
|
|
58746
58796
|
if (files.length) {
|
|
58747
58797
|
for (const file of files) {
|
|
58748
58798
|
if (file.endsWith(".ts")) {
|
|
58749
|
-
const migrationPath =
|
|
58799
|
+
const migrationPath = path12.userMigrationsPath(`${file}`);
|
|
58750
58800
|
if (fs5.existsSync(migrationPath))
|
|
58751
58801
|
await Bun.$`rm ${migrationPath}`;
|
|
58752
58802
|
}
|
|
@@ -58755,22 +58805,22 @@ async function resetSqliteDatabase() {
|
|
|
58755
58805
|
return ok("All tables dropped successfully!");
|
|
58756
58806
|
}
|
|
58757
58807
|
async function generateSqliteMigration(modelPath) {
|
|
58758
|
-
const files = await fs5.readdir(
|
|
58808
|
+
const files = await fs5.readdir(path12.userMigrationsPath());
|
|
58759
58809
|
if (files.length === 0) {
|
|
58760
58810
|
log7.debug("No migrations found in the database folder, deleting all framework/database/*.json files...");
|
|
58761
|
-
const modelFiles = await fs5.readdir(
|
|
58811
|
+
const modelFiles = await fs5.readdir(path12.frameworkPath("database/models"));
|
|
58762
58812
|
if (modelFiles.length) {
|
|
58763
58813
|
log7.debug("No existing model files in framework path...");
|
|
58764
58814
|
for (const file of modelFiles)
|
|
58765
58815
|
if (file.endsWith(".ts"))
|
|
58766
|
-
await fs5.unlink(
|
|
58816
|
+
await fs5.unlink(path12.frameworkPath(`database/models/${file}`));
|
|
58767
58817
|
}
|
|
58768
58818
|
}
|
|
58769
58819
|
const model2 = (await import(modelPath)).default;
|
|
58770
|
-
const fileName =
|
|
58771
|
-
const tableName = await
|
|
58820
|
+
const fileName = path12.basename(modelPath);
|
|
58821
|
+
const tableName = await getTableName(model2, modelPath);
|
|
58772
58822
|
const fieldsString = JSON.stringify(model2.attributes, null, 2);
|
|
58773
|
-
const copiedModelPath =
|
|
58823
|
+
const copiedModelPath = path12.frameworkPath(`database/models/${fileName}`);
|
|
58774
58824
|
let haveFieldsChanged = false;
|
|
58775
58825
|
if (fs5.existsSync(copiedModelPath)) {
|
|
58776
58826
|
log7.debug(`Fields have already been generated for ${tableName}`);
|
|
@@ -58796,9 +58846,9 @@ async function generateSqliteMigration(modelPath) {
|
|
|
58796
58846
|
async function createTableMigration3(modelPath) {
|
|
58797
58847
|
log7.debug("createTableMigration modelPath:", modelPath);
|
|
58798
58848
|
const model2 = (await import(modelPath)).default;
|
|
58799
|
-
const tableName = await
|
|
58800
|
-
await createPivotTableMigration3(model2);
|
|
58801
|
-
const otherModelRelations = await fetchOtherModelRelations(model2);
|
|
58849
|
+
const tableName = await getTableName(model2, modelPath);
|
|
58850
|
+
await createPivotTableMigration3(model2, modelPath);
|
|
58851
|
+
const otherModelRelations = await fetchOtherModelRelations(model2, modelPath);
|
|
58802
58852
|
const fields2 = model2.attributes;
|
|
58803
58853
|
const useTimestamps = model2?.traits?.useTimestamps ?? model2?.traits?.timestampable ?? true;
|
|
58804
58854
|
const useSoftDeletes = model2?.traits?.useSoftDeletes ?? model2?.traits?.softDeletable ?? false;
|
|
@@ -58839,12 +58889,12 @@ async function createTableMigration3(modelPath) {
|
|
|
58839
58889
|
migrationContent += `}\n`;
|
|
58840
58890
|
const timestamp = new Date().getTime().toString();
|
|
58841
58891
|
const migrationFileName = `${timestamp}-create-${tableName}-table.ts`;
|
|
58842
|
-
const migrationFilePath =
|
|
58892
|
+
const migrationFilePath = path12.userMigrationsPath(migrationFileName);
|
|
58843
58893
|
Bun.write(migrationFilePath, migrationContent);
|
|
58844
58894
|
log7.success(`Created migration: ${italic4(migrationFileName)}`);
|
|
58845
58895
|
}
|
|
58846
|
-
async function createPivotTableMigration3(model2) {
|
|
58847
|
-
const pivotTables = await getPivotTables(model2);
|
|
58896
|
+
async function createPivotTableMigration3(model2, modelPath) {
|
|
58897
|
+
const pivotTables = await getPivotTables(model2, modelPath);
|
|
58848
58898
|
if (!pivotTables.length)
|
|
58849
58899
|
return;
|
|
58850
58900
|
for (const pivotTable of pivotTables) {
|
|
@@ -58862,7 +58912,7 @@ async function createPivotTableMigration3(model2) {
|
|
|
58862
58912
|
migrationContent += ` }\n`;
|
|
58863
58913
|
const timestamp = new Date().getTime().toString();
|
|
58864
58914
|
const migrationFileName = `${timestamp}-create-${pivotTable.table}-table.ts`;
|
|
58865
|
-
const migrationFilePath =
|
|
58915
|
+
const migrationFilePath = path12.userMigrationsPath(migrationFileName);
|
|
58866
58916
|
Bun.write(migrationFilePath, migrationContent);
|
|
58867
58917
|
log7.success(`Created pivot migration: ${migrationFileName}`);
|
|
58868
58918
|
}
|
|
@@ -58870,8 +58920,8 @@ async function createPivotTableMigration3(model2) {
|
|
|
58870
58920
|
async function createAlterTableMigration3(modelPath) {
|
|
58871
58921
|
console.log("createAlterTableMigration");
|
|
58872
58922
|
const model2 = (await import(modelPath)).default;
|
|
58873
|
-
const modelName =
|
|
58874
|
-
const tableName = await
|
|
58923
|
+
const modelName = getModelName(model2, modelPath);
|
|
58924
|
+
const tableName = await getTableName(model2, modelPath);
|
|
58875
58925
|
const lastMigrationFields = await getLastMigrationFields(modelName);
|
|
58876
58926
|
const lastFields = lastMigrationFields ?? {};
|
|
58877
58927
|
const currentFields = model2.attributes;
|
|
@@ -58892,14 +58942,14 @@ async function createAlterTableMigration3(modelPath) {
|
|
|
58892
58942
|
migrationContent += `}\n`;
|
|
58893
58943
|
const timestamp = new Date().getTime().toString();
|
|
58894
58944
|
const migrationFileName = `${timestamp}-update-${tableName}-table.ts`;
|
|
58895
|
-
const migrationFilePath =
|
|
58945
|
+
const migrationFilePath = path12.userMigrationsPath(migrationFileName);
|
|
58896
58946
|
Bun.write(migrationFilePath, migrationContent);
|
|
58897
58947
|
log7.success(`Created migration: ${italic4(migrationFileName)}`);
|
|
58898
58948
|
}
|
|
58899
58949
|
|
|
58900
58950
|
// src/drivers/index.ts
|
|
58901
58951
|
async function getLastMigrationFields(modelName) {
|
|
58902
|
-
const oldModelPath =
|
|
58952
|
+
const oldModelPath = path14.frameworkPath(`database/models/${modelName}`);
|
|
58903
58953
|
const model2 = (await import(oldModelPath)).default;
|
|
58904
58954
|
let fields2 = {};
|
|
58905
58955
|
if (typeof model2.attributes === "object")
|
|
@@ -58908,12 +58958,6 @@ async function getLastMigrationFields(modelName) {
|
|
|
58908
58958
|
fields2 = JSON.parse(model2.attributes);
|
|
58909
58959
|
return fields2;
|
|
58910
58960
|
}
|
|
58911
|
-
async function modelTableName2(model2) {
|
|
58912
|
-
if (typeof model2 === "string") {
|
|
58913
|
-
model2 = (await import(model2)).default;
|
|
58914
|
-
}
|
|
58915
|
-
return model2.table ?? snakeCase2(plural2(model2?.name || ""));
|
|
58916
|
-
}
|
|
58917
58961
|
async function hasTableBeenMigrated(tableName) {
|
|
58918
58962
|
log8.debug(`hasTableBeenMigrated for table: ${tableName}`);
|
|
58919
58963
|
const results = await getExecutedMigrations();
|
|
@@ -58974,14 +59018,14 @@ function prepareTextColumnType(rule) {
|
|
|
58974
59018
|
return `'${columnType}'`;
|
|
58975
59019
|
}
|
|
58976
59020
|
async function checkPivotMigration(dynamicPart) {
|
|
58977
|
-
const files = await fs6.readdir(
|
|
59021
|
+
const files = await fs6.readdir(path14.userMigrationsPath());
|
|
58978
59022
|
return files.some((migrationFile) => {
|
|
58979
59023
|
const escapedDynamicPart = dynamicPart.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
58980
59024
|
const pattern = new RegExp(`(-${escapedDynamicPart}-)`);
|
|
58981
59025
|
return pattern.test(migrationFile);
|
|
58982
59026
|
});
|
|
58983
59027
|
}
|
|
58984
|
-
async function getRelations(model2) {
|
|
59028
|
+
async function getRelations(model2, modelPath) {
|
|
58985
59029
|
const relationsArray = ["hasOne", "hasMany", "belongsToMany", "hasOneThrough"];
|
|
58986
59030
|
const relationships = [];
|
|
58987
59031
|
for (const relation of relationsArray) {
|
|
@@ -58991,55 +59035,64 @@ async function getRelations(model2) {
|
|
|
58991
59035
|
if (isString(relationInstance)) {
|
|
58992
59036
|
relationModel = relationInstance;
|
|
58993
59037
|
}
|
|
58994
|
-
const modelRelationPath =
|
|
59038
|
+
const modelRelationPath = path14.userModelsPath(`${relationModel}.ts`);
|
|
58995
59039
|
const modelRelation = (await import(modelRelationPath)).default;
|
|
58996
|
-
const
|
|
59040
|
+
const modelName = getModelName(model2, modelPath);
|
|
59041
|
+
const formattedModelName = modelName.toLowerCase();
|
|
59042
|
+
const tableName = getTableName(model2, modelPath);
|
|
59043
|
+
const modelRelationTable = getModelName(modelRelation, modelRelationPath);
|
|
58997
59044
|
relationships.push({
|
|
58998
59045
|
relationship: relation,
|
|
58999
59046
|
model: relationModel,
|
|
59000
|
-
table:
|
|
59001
|
-
relationModel:
|
|
59002
|
-
relationTable:
|
|
59047
|
+
table: modelRelationTable,
|
|
59048
|
+
relationModel: modelName,
|
|
59049
|
+
relationTable: tableName,
|
|
59003
59050
|
foreignKey: relationInstance.foreignKey || `${formattedModelName}_id`,
|
|
59004
59051
|
relationName: relationInstance.relationName || "",
|
|
59005
59052
|
throughModel: relationInstance.through || "",
|
|
59006
59053
|
throughForeignKey: relationInstance.throughForeignKey || "",
|
|
59007
|
-
pivotTable: relationInstance?.pivotTable || `${formattedModelName}_${
|
|
59054
|
+
pivotTable: relationInstance?.pivotTable || `${formattedModelName}_${modelRelationTable}`
|
|
59008
59055
|
});
|
|
59009
59056
|
}
|
|
59010
59057
|
}
|
|
59011
59058
|
}
|
|
59012
59059
|
return relationships;
|
|
59013
59060
|
}
|
|
59014
|
-
async function fetchOtherModelRelations(model2) {
|
|
59015
|
-
const modelFiles = glob5.sync(
|
|
59061
|
+
async function fetchOtherModelRelations(model2, modelPath) {
|
|
59062
|
+
const modelFiles = glob5.sync(path14.userModelsPath("*.ts"));
|
|
59016
59063
|
const modelRelations = [];
|
|
59017
59064
|
for (let i = 0;i < modelFiles.length; i++) {
|
|
59018
59065
|
const modelFileElement = modelFiles[i];
|
|
59019
|
-
const modelFile = await import(modelFileElement);
|
|
59020
|
-
|
|
59066
|
+
const modelFile = (await import(modelFileElement)).default;
|
|
59067
|
+
const tableName = getTableName(model2, modelPath);
|
|
59068
|
+
const modelName = getModelName(model2, modelPath);
|
|
59069
|
+
const modelFileName = getTableName(modelFile, modelFileElement);
|
|
59070
|
+
if (tableName === modelFileName)
|
|
59021
59071
|
continue;
|
|
59022
|
-
const relations = await getRelations(modelFile
|
|
59072
|
+
const relations = await getRelations(modelFile, modelFileElement);
|
|
59023
59073
|
if (!relations.length)
|
|
59024
59074
|
continue;
|
|
59025
|
-
const relation = relations.find((relation2) => relation2.model ===
|
|
59075
|
+
const relation = relations.find((relation2) => relation2.model === modelName);
|
|
59026
59076
|
if (relation)
|
|
59027
59077
|
modelRelations.push(relation);
|
|
59028
59078
|
}
|
|
59029
59079
|
return modelRelations;
|
|
59030
59080
|
}
|
|
59031
|
-
async function getPivotTables(model2) {
|
|
59081
|
+
async function getPivotTables(model2, modelPath) {
|
|
59032
59082
|
const pivotTable = [];
|
|
59033
|
-
|
|
59083
|
+
const modelName = getTableName(model2, modelPath);
|
|
59084
|
+
if (model2.belongsToMany) {
|
|
59034
59085
|
if ("belongsToMany" in model2) {
|
|
59035
59086
|
for (const belongsToManyRelation of model2.belongsToMany) {
|
|
59036
|
-
const modelRelationPath =
|
|
59087
|
+
const modelRelationPath = path14.userModelsPath(`${belongsToManyRelation}.ts`);
|
|
59037
59088
|
const modelRelation = (await import(modelRelationPath)).default;
|
|
59038
|
-
const formattedModelName =
|
|
59039
|
-
const
|
|
59040
|
-
const
|
|
59089
|
+
const formattedModelName = modelName.toLowerCase();
|
|
59090
|
+
const modelRelationTable = getTableName(modelRelation, modelRelationPath);
|
|
59091
|
+
const modelRelationModelName = getModelName(modelRelation, modelRelationPath);
|
|
59092
|
+
const firstForeignKey = belongsToManyRelation.firstForeignKey || `${modelName.toLowerCase()}_${model2.primaryKey}`;
|
|
59093
|
+
const secondForeignKey = belongsToManyRelation.secondForeignKey || `${modelRelationModelName.toLowerCase()}_${model2.primaryKey}`;
|
|
59041
59094
|
pivotTable.push({
|
|
59042
|
-
table: belongsToManyRelation?.pivotTable || `${formattedModelName}_${
|
|
59095
|
+
table: belongsToManyRelation?.pivotTable || `${formattedModelName}_${modelRelationTable}`,
|
|
59043
59096
|
firstForeignKey,
|
|
59044
59097
|
secondForeignKey
|
|
59045
59098
|
});
|
|
@@ -59190,9 +59243,9 @@ function getDialect() {
|
|
|
59190
59243
|
const driver = database6.default ?? "sqlite";
|
|
59191
59244
|
log9.debug(`Using database driver: ${driver}`);
|
|
59192
59245
|
if (driver === "sqlite") {
|
|
59193
|
-
const
|
|
59246
|
+
const path15 = database6.connections?.sqlite.database ?? "database/stacks.sqlite";
|
|
59194
59247
|
return new BunWorkerDialect({
|
|
59195
|
-
url:
|
|
59248
|
+
url: path15
|
|
59196
59249
|
});
|
|
59197
59250
|
}
|
|
59198
59251
|
if (driver === "mysql") {
|
|
@@ -59258,7 +59311,7 @@ async function resetDatabase() {
|
|
|
59258
59311
|
async function generateMigrations() {
|
|
59259
59312
|
try {
|
|
59260
59313
|
log10.info("Generating migrations...");
|
|
59261
|
-
const modelFiles = glob6.sync(
|
|
59314
|
+
const modelFiles = glob6.sync(path16.userModelsPath("*.ts"));
|
|
59262
59315
|
for (const file of modelFiles) {
|
|
59263
59316
|
log10.debug("Generating migration for:", file);
|
|
59264
59317
|
await generateMigration(file);
|
|
@@ -59307,7 +59360,7 @@ async function lastMigrationDate() {
|
|
|
59307
59360
|
}
|
|
59308
59361
|
}
|
|
59309
59362
|
async function getLastMigrationFields2(modelName) {
|
|
59310
|
-
const oldModelPath =
|
|
59363
|
+
const oldModelPath = path16.frameworkPath(`database/models/${modelName}`);
|
|
59311
59364
|
const model2 = (await import(oldModelPath)).default;
|
|
59312
59365
|
let fields2 = {};
|
|
59313
59366
|
if (typeof model2.attributes === "object")
|
|
@@ -59324,15 +59377,15 @@ var migrator = new Migrator({
|
|
|
59324
59377
|
db,
|
|
59325
59378
|
provider: new FileMigrationProvider({
|
|
59326
59379
|
fs: fs7,
|
|
59327
|
-
path:
|
|
59328
|
-
migrationFolder:
|
|
59380
|
+
path: path16,
|
|
59381
|
+
migrationFolder: path16.userMigrationsPath()
|
|
59329
59382
|
}),
|
|
59330
59383
|
migrationTableName: database7.migrations,
|
|
59331
59384
|
migrationLockTableName: database7.migrationLocks
|
|
59332
59385
|
});
|
|
59333
59386
|
// src/seeder.ts
|
|
59334
59387
|
import {italic as italic6, log as log11} from "@stacksjs/cli";
|
|
59335
|
-
import {path as
|
|
59388
|
+
import {path as path18} from "@stacksjs/path";
|
|
59336
59389
|
import {fs as fs8, glob as glob7} from "@stacksjs/storage";
|
|
59337
59390
|
async function seedModel(name, model2) {
|
|
59338
59391
|
if (model2?.traits?.useSeeder === false || model2?.traits?.seedable === false) {
|
|
@@ -59340,7 +59393,7 @@ async function seedModel(name, model2) {
|
|
|
59340
59393
|
return;
|
|
59341
59394
|
}
|
|
59342
59395
|
if (!model2)
|
|
59343
|
-
model2 = await import(
|
|
59396
|
+
model2 = await import(path18.userModelsPath(name));
|
|
59344
59397
|
const tableName = await modelTableName(model2);
|
|
59345
59398
|
const seedCount = typeof model2.traits?.useSeeder === "object" && model2.traits?.useSeeder?.count ? model2.traits.useSeeder.count : 10;
|
|
59346
59399
|
log11.info(`Seeding ${seedCount} records into ${italic6(tableName)}`);
|
|
@@ -59364,7 +59417,7 @@ async function seedModel(name, model2) {
|
|
|
59364
59417
|
await db.insertInto(tableName).values(records).execute();
|
|
59365
59418
|
}
|
|
59366
59419
|
async function seedModelRelation(modelName) {
|
|
59367
|
-
const modelInstance = (await import(
|
|
59420
|
+
const modelInstance = (await import(path18.userModelsPath(modelName))).default;
|
|
59368
59421
|
if (!modelInstance)
|
|
59369
59422
|
return 1;
|
|
59370
59423
|
const record = {};
|
|
@@ -59386,7 +59439,7 @@ async function getRelations2(model2) {
|
|
|
59386
59439
|
if (isString(relationInstance)) {
|
|
59387
59440
|
relationModel = relationInstance;
|
|
59388
59441
|
}
|
|
59389
|
-
const modelRelationPath =
|
|
59442
|
+
const modelRelationPath = path18.userModelsPath(`${relationModel}.ts`);
|
|
59390
59443
|
const modelRelation = (await import(modelRelationPath)).default;
|
|
59391
59444
|
const formattedModelName = model2.name?.toLowerCase();
|
|
59392
59445
|
relationships.push({
|
|
@@ -59407,7 +59460,7 @@ async function getRelations2(model2) {
|
|
|
59407
59460
|
return relationships;
|
|
59408
59461
|
}
|
|
59409
59462
|
async function fetchOtherModelRelations2(model2) {
|
|
59410
|
-
const modelFiles = glob7.sync(
|
|
59463
|
+
const modelFiles = glob7.sync(path18.userModelsPath("*.ts"));
|
|
59411
59464
|
const modelRelations = [];
|
|
59412
59465
|
for (let i = 0;i < modelFiles.length; i++) {
|
|
59413
59466
|
const modelFileElement = modelFiles[i];
|
|
@@ -59427,7 +59480,7 @@ var hasRelations2 = function(obj, key) {
|
|
|
59427
59480
|
return key in obj;
|
|
59428
59481
|
};
|
|
59429
59482
|
async function seed() {
|
|
59430
|
-
const dbPath =
|
|
59483
|
+
const dbPath = path18.userDatabasePath("stacks.sqlite");
|
|
59431
59484
|
if (!fs8.existsSync(dbPath)) {
|
|
59432
59485
|
log11.warn("No database found, configuring it...");
|
|
59433
59486
|
await resetDatabase();
|
|
@@ -59436,15 +59489,15 @@ async function seed() {
|
|
|
59436
59489
|
} else {
|
|
59437
59490
|
log11.debug("Database configured...");
|
|
59438
59491
|
}
|
|
59439
|
-
const customSeederPath =
|
|
59492
|
+
const customSeederPath = path18.userDatabasePath("seeder.ts");
|
|
59440
59493
|
if (fs8.existsSync(customSeederPath)) {
|
|
59441
59494
|
log11.info("Custom seeder found");
|
|
59442
59495
|
await import(customSeederPath);
|
|
59443
59496
|
}
|
|
59444
|
-
const modelsDir =
|
|
59497
|
+
const modelsDir = path18.userModelsPath();
|
|
59445
59498
|
const modelFiles = fs8.readdirSync(modelsDir).filter((file) => file.endsWith(".ts"));
|
|
59446
59499
|
for (const file of modelFiles) {
|
|
59447
|
-
const modelPath =
|
|
59500
|
+
const modelPath = path18.join(modelsDir, file);
|
|
59448
59501
|
const model2 = await import(modelPath);
|
|
59449
59502
|
await seedModel(file, model2.default);
|
|
59450
59503
|
}
|