@sqlanvil/cli 1.32.10 → 1.33.1
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/README.md +1 -1
- package/bundle.js +968 -773
- package/package.json +1 -1
- package/worker_bundle.js +33 -36
package/package.json
CHANGED
package/worker_bundle.js
CHANGED
|
@@ -49557,7 +49557,7 @@ Struct.verify = function (object) {
|
|
|
49557
49557
|
for (const [k, v] of Object.entries(object)) {
|
|
49558
49558
|
fields[k] = unknownToValueShallow(v);
|
|
49559
49559
|
}
|
|
49560
|
-
Object.keys(object).forEach(key => delete object[key]);
|
|
49560
|
+
Object.keys(object).forEach((key) => delete object[key]);
|
|
49561
49561
|
object.fields = fields;
|
|
49562
49562
|
}
|
|
49563
49563
|
return originalVerify.call(this, object);
|
|
@@ -49568,7 +49568,7 @@ Struct.fromObject = function (object) {
|
|
|
49568
49568
|
for (const [k, v] of Object.entries(object)) {
|
|
49569
49569
|
fields[k] = unknownToValueShallow(v);
|
|
49570
49570
|
}
|
|
49571
|
-
Object.keys(object).forEach(key => delete object[key]);
|
|
49571
|
+
Object.keys(object).forEach((key) => delete object[key]);
|
|
49572
49572
|
object.fields = fields;
|
|
49573
49573
|
}
|
|
49574
49574
|
return originalFromObject.call(this, object);
|
|
@@ -49617,48 +49617,34 @@ function compile(compileConfig) {
|
|
|
49617
49617
|
context: "sandbox",
|
|
49618
49618
|
root: compileConfig.projectDir,
|
|
49619
49619
|
external: true,
|
|
49620
|
-
builtin: ["path"]
|
|
49621
|
-
}
|
|
49620
|
+
builtin: ["path"],
|
|
49621
|
+
},
|
|
49622
49622
|
});
|
|
49623
49623
|
const compiler = indexGeneratorVm.run('return require("@sqlanvil/core").compiler', vmIndexFileName);
|
|
49624
49624
|
const sqlanvilCoreVersion = indexGeneratorVm.run('return require("@sqlanvil/core").version || "0.0.0"', vmIndexFileName);
|
|
49625
|
-
|
|
49626
|
-
const cliVersion = readCliVersion();
|
|
49627
|
-
const cliParsed = semver__namespace.parse(cliVersion);
|
|
49628
|
-
if (cliParsed && cliVersion !== "0.0.0") {
|
|
49629
|
-
const minCoreVersion = `${cliParsed.major}.${cliParsed.minor}.0`;
|
|
49630
|
-
if (semver__namespace.major(sqlanvilCoreVersion) !== cliParsed.major ||
|
|
49631
|
-
semver__namespace.lt(sqlanvilCoreVersion, minCoreVersion)) {
|
|
49632
|
-
throw new Error(`@sqlanvil/core ${sqlanvilCoreVersion} is not compatible with @sqlanvil/cli ` +
|
|
49633
|
-
`${cliVersion}. The CLI requires @sqlanvil/core >= ${minCoreVersion} ` +
|
|
49634
|
-
`(matching major.minor). Set \`sqlanvilCoreVersion: ${cliVersion}\` in ` +
|
|
49635
|
-
`workflow_settings.yaml (or pin @sqlanvil/core in package.json), then run ` +
|
|
49636
|
-
`\`sqlanvil install\`.`);
|
|
49637
|
-
}
|
|
49638
|
-
}
|
|
49639
|
-
const needsCallerFileShim = semver__namespace.lt(coreDataformVersion, "3.0.57");
|
|
49625
|
+
checkCoreCompatibility(sqlanvilCoreVersion, readCliVersion());
|
|
49640
49626
|
const fileStack = [];
|
|
49641
49627
|
const userCodeVm = new vm2.NodeVM({
|
|
49642
49628
|
wrapper: "none",
|
|
49643
49629
|
sandbox: {
|
|
49644
|
-
__df_enter: (p) => {
|
|
49645
|
-
|
|
49646
|
-
|
|
49630
|
+
__df_enter: (p) => {
|
|
49631
|
+
fileStack.push(p);
|
|
49632
|
+
},
|
|
49633
|
+
__df_exit: () => {
|
|
49634
|
+
fileStack.pop();
|
|
49635
|
+
},
|
|
49636
|
+
__df_current: () => (fileStack.length > 0 ? fileStack[fileStack.length - 1] : null),
|
|
49647
49637
|
},
|
|
49648
49638
|
require: {
|
|
49649
49639
|
builtin: ["path"],
|
|
49650
49640
|
context: "sandbox",
|
|
49651
49641
|
external: true,
|
|
49652
49642
|
root: compileConfig.projectDir,
|
|
49653
|
-
resolve: (moduleName, parentDirName) => path__namespace.join(parentDirName, path__namespace.relative(parentDirName, compileConfig.projectDir), moduleName)
|
|
49643
|
+
resolve: (moduleName, parentDirName) => path__namespace.join(parentDirName, path__namespace.relative(parentDirName, compileConfig.projectDir), moduleName),
|
|
49654
49644
|
},
|
|
49655
49645
|
sourceExtensions: ["js", "sql", "sqlx", "yaml", "yml"],
|
|
49656
49646
|
compiler: (code, filePath) => {
|
|
49657
|
-
|
|
49658
|
-
if (needsCallerFileShim && filePath === coreBundlePath) {
|
|
49659
|
-
source = patchOldCoreCallerFile(source);
|
|
49660
|
-
}
|
|
49661
|
-
const compiledCode = compiler(source, filePath);
|
|
49647
|
+
const compiledCode = compiler(code, filePath);
|
|
49662
49648
|
return `
|
|
49663
49649
|
__df_enter(${JSON.stringify(filePath)});
|
|
49664
49650
|
try {
|
|
@@ -49667,7 +49653,7 @@ function compile(compileConfig) {
|
|
|
49667
49653
|
__df_exit();
|
|
49668
49654
|
}
|
|
49669
49655
|
`;
|
|
49670
|
-
}
|
|
49656
|
+
},
|
|
49671
49657
|
});
|
|
49672
49658
|
const hasWorkflowSettingsYaml = fs__namespace.existsSync(path__namespace.join(compileConfig.projectDir, "workflow_settings.yaml"));
|
|
49673
49659
|
return userCodeVm.run(`
|
|
@@ -49677,7 +49663,7 @@ function compile(compileConfig) {
|
|
|
49677
49663
|
});
|
|
49678
49664
|
${hasWorkflowSettingsYaml
|
|
49679
49665
|
? 'global.workflowSettingsYaml = require("./workflow_settings.yaml");'
|
|
49680
|
-
:
|
|
49666
|
+
: ""}
|
|
49681
49667
|
return require("@sqlanvil/core").main("${createCoreExecutionRequest(compileConfig)}")
|
|
49682
49668
|
`, vmIndexFileName);
|
|
49683
49669
|
}
|
|
@@ -49715,16 +49701,27 @@ function readCliVersion() {
|
|
|
49715
49701
|
return "0.0.0";
|
|
49716
49702
|
}
|
|
49717
49703
|
}
|
|
49718
|
-
const
|
|
49719
|
-
|
|
49720
|
-
|
|
49721
|
-
|
|
49722
|
-
|
|
49704
|
+
const MIN_SUPPORTED_CORE_VERSION = "1.0.0";
|
|
49705
|
+
function checkCoreCompatibility(coreVersion, cliVersion) {
|
|
49706
|
+
const cliParsed = semver__namespace.parse(cliVersion);
|
|
49707
|
+
if (!cliParsed || cliVersion === "0.0.0") {
|
|
49708
|
+
return;
|
|
49709
|
+
}
|
|
49710
|
+
const majorFloor = `${cliParsed.major}.0.0`;
|
|
49711
|
+
const minCoreVersion = semver__namespace.gt(MIN_SUPPORTED_CORE_VERSION, majorFloor)
|
|
49712
|
+
? MIN_SUPPORTED_CORE_VERSION
|
|
49713
|
+
: majorFloor;
|
|
49714
|
+
if (semver__namespace.major(coreVersion) !== cliParsed.major || semver__namespace.lt(coreVersion, minCoreVersion)) {
|
|
49715
|
+
throw new Error(`@sqlanvil/core ${coreVersion} is not compatible with @sqlanvil/cli ${cliVersion}. ` +
|
|
49716
|
+
`The CLI requires @sqlanvil/core >=${minCoreVersion} <${cliParsed.major + 1}.0.0. ` +
|
|
49717
|
+
`Set \`sqlanvilCoreVersion: ${cliVersion}\` in workflow_settings.yaml, or pin ` +
|
|
49718
|
+
`@sqlanvil/core in package.json and run \`sqlanvil install\`.`);
|
|
49719
|
+
}
|
|
49723
49720
|
}
|
|
49724
49721
|
function createCoreExecutionRequest(compileConfig) {
|
|
49725
49722
|
const filePaths = Array.from(new Set(glob__namespace.sync("!(node_modules)/**/*.*", { cwd: compileConfig.projectDir })));
|
|
49726
49723
|
return encode64(sqlanvil.CoreExecutionRequest, {
|
|
49727
|
-
compile: { compileConfig: Object.assign({ filePaths }, compileConfig) }
|
|
49724
|
+
compile: { compileConfig: Object.assign({ filePaths }, compileConfig) },
|
|
49728
49725
|
});
|
|
49729
49726
|
}
|
|
49730
49727
|
|