varlock 0.2.3 → 0.4.0
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 +23 -10
- package/dist/chunk-36LTSUR6.js +48 -0
- package/dist/chunk-36LTSUR6.js.map +1 -0
- package/dist/{chunk-UDXNNRWI.js → chunk-4A54P4EM.js} +10 -10
- package/dist/chunk-4A54P4EM.js.map +1 -0
- package/dist/chunk-4DZ3IHF6.js +34 -0
- package/dist/chunk-4DZ3IHF6.js.map +1 -0
- package/dist/{chunk-Q3C4VKFT.js → chunk-5HF5TS2C.js} +17 -41
- package/dist/chunk-5HF5TS2C.js.map +1 -0
- package/dist/chunk-ALNELNTO.js +68 -0
- package/dist/chunk-ALNELNTO.js.map +1 -0
- package/dist/{chunk-YIXN7TC7.js → chunk-BS7P3FRR.js} +40 -64
- package/dist/chunk-BS7P3FRR.js.map +1 -0
- package/dist/{chunk-OY5U5WTF.js → chunk-CBP4M7BN.js} +2969 -2140
- package/dist/chunk-CBP4M7BN.js.map +1 -0
- package/dist/{chunk-HTF7NU5C.js → chunk-EDSWMPIV.js} +11 -19
- package/dist/chunk-EDSWMPIV.js.map +1 -0
- package/dist/{chunk-BXR2RIO6.js → chunk-F5WNDO7I.js} +6 -5
- package/dist/chunk-F5WNDO7I.js.map +1 -0
- package/dist/{chunk-35SAMS66.js → chunk-GJ7PTJM4.js} +3 -3
- package/dist/{chunk-35SAMS66.js.map → chunk-GJ7PTJM4.js.map} +1 -1
- package/dist/chunk-HRNVJUR5.js +17 -0
- package/dist/chunk-HRNVJUR5.js.map +1 -0
- package/dist/{chunk-PESTWPBG.js → chunk-QNKJGOQ6.js} +8 -6
- package/dist/chunk-QNKJGOQ6.js.map +1 -0
- package/dist/chunk-VKRGHRPK.js +331 -0
- package/dist/chunk-VKRGHRPK.js.map +1 -0
- package/dist/chunk-WIIXKZ3N.js +405 -0
- package/dist/chunk-WIIXKZ3N.js.map +1 -0
- package/dist/chunk-Y3ITSQA4.js +58 -0
- package/dist/chunk-Y3ITSQA4.js.map +1 -0
- package/dist/{chunk-ISSW6NKZ.js → chunk-YFP6VA2U.js} +20 -17
- package/dist/chunk-YFP6VA2U.js.map +1 -0
- package/dist/cli/cli-executable.js +56 -38
- package/dist/cli/cli-executable.js.map +1 -1
- package/dist/config-item-GN5AUR45.js +5 -0
- package/dist/config-item-GN5AUR45.js.map +1 -0
- package/dist/{env-graph-DIcuAiYh.d.ts → env-graph-COORmJlH.d.ts} +121 -2
- package/dist/help.command-7E52XAOO.js +5 -0
- package/dist/{help.command-MLH2WA5Y.js.map → help.command-7E52XAOO.js.map} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/init.command-FMHXUGDI.js +12 -0
- package/dist/{init.command-RAYBZ66R.js.map → init.command-FMHXUGDI.js.map} +1 -1
- package/dist/load.command-6I2D5BPL.js +11 -0
- package/dist/{load.command-KOSPGLV6.js.map → load.command-6I2D5BPL.js.map} +1 -1
- package/dist/plugin-lib.d.ts +2 -2
- package/dist/printenv.command-TROZTZ26.js +12 -0
- package/dist/printenv.command-TROZTZ26.js.map +1 -0
- package/dist/run.command-4OJ6MBP6.js +12 -0
- package/dist/{run.command-BOBQIELJ.js.map → run.command-4OJ6MBP6.js.map} +1 -1
- package/dist/runtime/env.d.ts +1 -1
- package/dist/scan.command-YRNAKUZT.js +13 -0
- package/dist/scan.command-YRNAKUZT.js.map +1 -0
- package/dist/telemetry.command-UZQSUYAY.js +11 -0
- package/dist/{telemetry.command-SFEMMU3U.js.map → telemetry.command-UZQSUYAY.js.map} +1 -1
- package/dist/typegen.command-V4MATON4.js +12 -0
- package/dist/typegen.command-V4MATON4.js.map +1 -0
- package/package.json +18 -17
- package/LICENSE +0 -21
- package/dist/chunk-BXR2RIO6.js.map +0 -1
- package/dist/chunk-HTF7NU5C.js.map +0 -1
- package/dist/chunk-ISSW6NKZ.js.map +0 -1
- package/dist/chunk-OY5U5WTF.js.map +0 -1
- package/dist/chunk-PESTWPBG.js.map +0 -1
- package/dist/chunk-Q3C4VKFT.js.map +0 -1
- package/dist/chunk-UDXNNRWI.js.map +0 -1
- package/dist/chunk-YIXN7TC7.js.map +0 -1
- package/dist/help.command-MLH2WA5Y.js +0 -5
- package/dist/init.command-RAYBZ66R.js +0 -9
- package/dist/load.command-KOSPGLV6.js +0 -9
- package/dist/run.command-BOBQIELJ.js +0 -10
- package/dist/telemetry.command-SFEMMU3U.js +0 -9
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ansis_default,
|
|
1
|
+
import { ansis_default, gracefulExit, getItemSummary, joinAndCompact } from './chunk-VKRGHRPK.js';
|
|
2
|
+
import { VarlockError, my_dash_default } from './chunk-CBP4M7BN.js';
|
|
2
3
|
import { __name } from './chunk-6PEHRAEP.js';
|
|
3
4
|
|
|
4
5
|
// src/cli/helpers/error-checks.ts
|
|
@@ -14,6 +15,14 @@ function showErrorLocationDetails(err) {
|
|
|
14
15
|
console.log(errPreview);
|
|
15
16
|
}
|
|
16
17
|
__name(showErrorLocationDetails, "showErrorLocationDetails");
|
|
18
|
+
function checkForNoEnvFiles(envGraph) {
|
|
19
|
+
if (Object.keys(envGraph.configSchema).length === 0) {
|
|
20
|
+
console.error("\u{1F6A8} No .env or .env.schema files found\n");
|
|
21
|
+
console.error("Run `varlock init` to create a .env.schema file, or use `--path` to specify a file or directory.");
|
|
22
|
+
return gracefulExit(1);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
__name(checkForNoEnvFiles, "checkForNoEnvFiles");
|
|
17
26
|
function checkForSchemaErrors(envGraph) {
|
|
18
27
|
for (const source of envGraph.sortedDataSources) {
|
|
19
28
|
if (source.loadingError) {
|
|
@@ -58,11 +67,16 @@ function checkForConfigErrors(envGraph, opts) {
|
|
|
58
67
|
console.log(`\u{1F6A8} Root decorator error(s) in ${source.label}`);
|
|
59
68
|
for (const err of source.resolutionErrors) {
|
|
60
69
|
console.log(`- ${err.message}`);
|
|
70
|
+
if (err instanceof VarlockError && err.tip) {
|
|
71
|
+
for (const line of err.tip.split("\n")) {
|
|
72
|
+
console.log(` ${line}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
61
75
|
showErrorLocationDetails(err);
|
|
62
76
|
}
|
|
63
77
|
}
|
|
64
78
|
}
|
|
65
|
-
const failingItems =
|
|
79
|
+
const failingItems = envGraph.sortedConfigKeys.map((k) => envGraph.configSchema[k]).filter((item) => item.validationState === "error");
|
|
66
80
|
if (failingItems.length > 0) {
|
|
67
81
|
console.error(`
|
|
68
82
|
\u{1F6A8} \u{1F6A8} \u{1F6A8} ${ansis_default.bold.underline("Configuration is currently invalid ")} \u{1F6A8} \u{1F6A8} \u{1F6A8}
|
|
@@ -79,7 +93,7 @@ function checkForConfigErrors(envGraph, opts) {
|
|
|
79
93
|
ansis_default.italic.gray("(remove `--show-all` flag to hide)")
|
|
80
94
|
]));
|
|
81
95
|
console.error();
|
|
82
|
-
const validItems =
|
|
96
|
+
const validItems = envGraph.sortedConfigKeys.map((k) => envGraph.configSchema[k]).filter((i) => !!i.isValid);
|
|
83
97
|
my_dash_default.each(validItems, (item) => {
|
|
84
98
|
console.error(getItemSummary(item));
|
|
85
99
|
});
|
|
@@ -89,17 +103,6 @@ function checkForConfigErrors(envGraph, opts) {
|
|
|
89
103
|
}
|
|
90
104
|
__name(checkForConfigErrors, "checkForConfigErrors");
|
|
91
105
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
...opts,
|
|
96
|
-
afterInit: /* @__PURE__ */ __name(async (_g) => {
|
|
97
|
-
}, "afterInit")
|
|
98
|
-
});
|
|
99
|
-
return envGraph;
|
|
100
|
-
}
|
|
101
|
-
__name(loadVarlockEnvGraph, "loadVarlockEnvGraph");
|
|
102
|
-
|
|
103
|
-
export { InvalidEnvError, checkForConfigErrors, checkForSchemaErrors, loadVarlockEnvGraph };
|
|
104
|
-
//# sourceMappingURL=chunk-ISSW6NKZ.js.map
|
|
105
|
-
//# sourceMappingURL=chunk-ISSW6NKZ.js.map
|
|
106
|
+
export { InvalidEnvError, checkForConfigErrors, checkForNoEnvFiles, checkForSchemaErrors };
|
|
107
|
+
//# sourceMappingURL=chunk-YFP6VA2U.js.map
|
|
108
|
+
//# sourceMappingURL=chunk-YFP6VA2U.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/helpers/error-checks.ts"],"names":[],"mappings":";;;;;AAQA,SAAS,yBAAyB,GAAA,EAAY;AAC5C,EAAA,IAAI,EAAE,GAAA,YAAe,YAAA,CAAA,IAAiB,CAAC,IAAI,QAAA,EAAU;AACrD,EAAA,MAAM,SAAS,GAAA,CAAI,QAAA;AACnB,EAAA,MAAM,UAAA,GAAa;AAAA,IACjB,MAAA,CAAO,OAAA;AAAA,IACP,CAAA,EAAG,aAAA,CAAM,IAAA,CAAK,GAAA,CAAI,OAAO,MAAA,CAAO,SAAA,GAAY,CAAC,CAAC,CAAC,CAAA,EAAG,aAAA,CAAM,GAAA,CAAI,GAAG,CAAC,CAAA;AAAA,GAClE,CAAE,KAAK,IAAI,CAAA;AAEX,EAAA,OAAA,CAAQ,IAAI,EAAE,CAAA;AACd,EAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,UAAA,EAAM,MAAA,CAAO,EAAE,CAAA,CAAA,EAAI,OAAO,UAAU,CAAA,CAAA,EAAI,MAAA,CAAO,SAAS,CAAA,CAAE,CAAA;AACtE,EAAA,OAAA,CAAQ,IAAI,UAAU,CAAA;AACxB;AAXS,MAAA,CAAA,wBAAA,EAAA,0BAAA,CAAA;AAaF,SAAS,mBAAmB,QAAA,EAAoB;AACrD,EAAA,IAAI,OAAO,IAAA,CAAK,QAAA,CAAS,YAAY,CAAA,CAAE,WAAW,CAAA,EAAG;AACnD,IAAA,OAAA,CAAQ,MAAM,gDAAyC,CAAA;AACvD,IAAA,OAAA,CAAQ,MAAM,kGAAkG,CAAA;AAChH,IAAA,OAAO,a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vGraph, ConfigItem } from '../../env-graph';\nimport { getItemSummary, joinAndCompact } from '../../lib/formatting';\nimport { VarlockError } from '../../env-graph/lib/errors';\n\n\nfunction showErrorLocationDetails(err: Error) {\n if (!(err instanceof VarlockError) || !err.location) return;\n const errLoc = err.location;\n const errPreview = [\n errLoc.lineStr,\n `${ansis.gray('-'.repeat(errLoc.colNumber - 1))}${ansis.red('^')}`,\n ].join('\\n');\n\n console.log('');\n console.log(`📂 ${errLoc.id}:${errLoc.lineNumber}:${errLoc.colNumber}`);\n console.log(errPreview);\n}\n\nexport function checkForNoEnvFiles(envGraph: EnvGraph) {\n if (Object.keys(envGraph.configSchema).length === 0) {\n console.error('🚨 No .env or .env.schema files found\\n');\n console.error('Run `varlock init` to create a .env.schema file, or use `--path` to specify a file or directory.');\n return gracefulExit(1);\n }\n}\n\nexport function checkForSchemaErrors(envGraph: EnvGraph) {\n // first we check for loading/parse errors - some cases we may want to let it fail silently?\n for (const source of envGraph.sortedDataSources) {\n // do we care about loading errors from disabled sources?\n // if (source.disabled) continue;\n\n if (source.loadingError) {\n console.log(`🚨 Error encountered while loading ${source.label}\\n`);\n\n console.log(source.loadingError.message);\n showErrorLocationDetails(source.loadingError);\n\n // For plugin loading errors, show the full stack trace since it's usually\n // a runtime error from executing the plugin code\n if (source.loadingError.stack && !(source.loadingError instanceof VarlockError)) {\n console.log(`\\n${ansis.dim('Stack trace:')}`);\n console.log(ansis.dim(source.loadingError.stack));\n }\n\n return gracefulExit(1);\n }\n // TODO: unify this with the above!\n if (source.schemaErrors.length) {\n console.log(`🚨 Error(s) encountered in ${source.label}`);\n\n for (const schemaErr of source.schemaErrors) {\n console.log(`- ${schemaErr.message}`);\n showErrorLocationDetails(schemaErr);\n }\n return gracefulExit(1);\n }\n }\n\n // now we check for any schema errors - where something about how things are wired up is invalid\n // NOTE - we should not have run any resolution yet\n // TODO: make sure we are calling this before attempting to resolve values\n // const failingItems = _.filter(_.values(envGraph.configSchema), (item) => item.validationState === 'error');\n // if (failingItems.length > 0) {\n // throw new CliExitError('Schema is currently invalid');\n // }\n}\n\n\nexport class InvalidEnvError extends Error {\n constructor() {\n super('Resolved config/env did not pass validation');\n }\n getFormattedOutput() {\n return `\\n💥 ${ansis.red(this.message)} 💥\\n`;\n }\n}\n\nexport function checkForConfigErrors(envGraph: EnvGraph, opts?: {\n showAll?: boolean\n}) {\n // check for root decorator \"execution\"\n for (const source of envGraph.sortedDataSources) {\n if (source.resolutionErrors.length) {\n console.log(`🚨 Root decorator error(s) in ${source.label}`);\n\n for (const err of source.resolutionErrors) {\n console.log(`- ${err.message}`);\n if (err instanceof VarlockError && err.tip) {\n for (const line of err.tip.split('\\n')) {\n console.log(` ${line}`);\n }\n }\n showErrorLocationDetails(err);\n }\n }\n }\n\n\n\n const failingItems = envGraph.sortedConfigKeys\n .map((k) => envGraph.configSchema[k])\n .filter((item) => item.validationState === 'error');\n\n // TODO: use service.isValid?\n if (failingItems.length > 0) {\n console.error(`\\n🚨 🚨 🚨 ${ansis.bold.underline('Configuration is currently invalid ')} 🚨 🚨 🚨\\n`);\n console.error('Invalid items:\\n');\n\n _.each(failingItems, (item: ConfigItem) => {\n console.error(getItemSummary(item));\n console.error();\n });\n if (opts?.showAll) {\n console.error();\n console.error(joinAndCompact([\n 'Valid items:',\n ansis.italic.gray('(remove `--show-all` flag to hide)'),\n ]));\n console.error();\n const validItems = envGraph.sortedConfigKeys\n .map((k) => envGraph.configSchema[k])\n .filter((i) => !!i.isValid);\n _.each(validItems, (item: ConfigItem) => {\n console.error(getItemSummary(item));\n });\n }\n\n throw new InvalidEnvError();\n }\n}\n"]}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import { commandSpec } from '../chunk-
|
|
2
|
-
import { commandSpec as commandSpec$
|
|
3
|
-
import { commandSpec as commandSpec$
|
|
4
|
-
import { commandSpec
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { commandSpec as commandSpec$5 } from '../chunk-F5WNDO7I.js';
|
|
2
|
+
import { commandSpec as commandSpec$6 } from '../chunk-WIIXKZ3N.js';
|
|
3
|
+
import { commandSpec as commandSpec$7 } from '../chunk-36LTSUR6.js';
|
|
4
|
+
import { commandSpec } from '../chunk-BS7P3FRR.js';
|
|
5
|
+
import '../chunk-Y3ITSQA4.js';
|
|
6
|
+
import { fmt } from '../chunk-5HF5TS2C.js';
|
|
7
|
+
import { commandSpec as commandSpec$1 } from '../chunk-EDSWMPIV.js';
|
|
8
|
+
import { commandSpec as commandSpec$2 } from '../chunk-QNKJGOQ6.js';
|
|
9
|
+
import { commandSpec as commandSpec$3 } from '../chunk-ALNELNTO.js';
|
|
10
|
+
import { CliExitError } from '../chunk-4DZ3IHF6.js';
|
|
11
|
+
import { commandSpec as commandSpec$4 } from '../chunk-GJ7PTJM4.js';
|
|
12
|
+
import { cli } from '../chunk-4A54P4EM.js';
|
|
13
|
+
import { InvalidEnvError } from '../chunk-YFP6VA2U.js';
|
|
14
|
+
import '../chunk-HRNVJUR5.js';
|
|
15
|
+
import { ansis_default, gracefulExit, asyncExitHook } from '../chunk-VKRGHRPK.js';
|
|
16
|
+
import '../chunk-CBP4M7BN.js';
|
|
10
17
|
import { createDebug } from '../chunk-QZ6HBRJC.js';
|
|
11
18
|
import '../chunk-WAMBVZL2.js';
|
|
12
19
|
import '../chunk-MIBOBKI4.js';
|
|
@@ -17,9 +24,9 @@ import { join, dirname } from 'path';
|
|
|
17
24
|
import fs, { existsSync, readFileSync, mkdirSync, writeFileSync } from 'fs';
|
|
18
25
|
import process2 from 'process';
|
|
19
26
|
|
|
20
|
-
// ../../node_modules/.
|
|
27
|
+
// ../../node_modules/.bun/ci-info@4.4.0/node_modules/ci-info/vendors.json
|
|
21
28
|
var require_vendors = __commonJS({
|
|
22
|
-
"../../node_modules/.
|
|
29
|
+
"../../node_modules/.bun/ci-info@4.4.0/node_modules/ci-info/vendors.json"(exports$1, module) {
|
|
23
30
|
module.exports = [
|
|
24
31
|
{
|
|
25
32
|
name: "Agola CI",
|
|
@@ -27,6 +34,11 @@ var require_vendors = __commonJS({
|
|
|
27
34
|
env: "AGOLA_GIT_REF",
|
|
28
35
|
pr: "AGOLA_PULL_REQUEST_ID"
|
|
29
36
|
},
|
|
37
|
+
{
|
|
38
|
+
name: "Alpic",
|
|
39
|
+
constant: "ALPIC",
|
|
40
|
+
env: "ALPIC_HOST"
|
|
41
|
+
},
|
|
30
42
|
{
|
|
31
43
|
name: "Appcircle",
|
|
32
44
|
constant: "APPCIRCLE",
|
|
@@ -381,35 +393,35 @@ var require_vendors = __commonJS({
|
|
|
381
393
|
}
|
|
382
394
|
});
|
|
383
395
|
|
|
384
|
-
// ../../node_modules/.
|
|
396
|
+
// ../../node_modules/.bun/ci-info@4.4.0/node_modules/ci-info/index.js
|
|
385
397
|
var require_ci_info = __commonJS({
|
|
386
|
-
"../../node_modules/.
|
|
398
|
+
"../../node_modules/.bun/ci-info@4.4.0/node_modules/ci-info/index.js"(exports$1) {
|
|
387
399
|
var vendors = require_vendors();
|
|
388
400
|
var env = process.env;
|
|
389
|
-
Object.defineProperty(exports, "_vendors", {
|
|
401
|
+
Object.defineProperty(exports$1, "_vendors", {
|
|
390
402
|
value: vendors.map(function(v) {
|
|
391
403
|
return v.constant;
|
|
392
404
|
})
|
|
393
405
|
});
|
|
394
|
-
exports.name = null;
|
|
395
|
-
exports.isPR = null;
|
|
396
|
-
exports.id = null;
|
|
406
|
+
exports$1.name = null;
|
|
407
|
+
exports$1.isPR = null;
|
|
408
|
+
exports$1.id = null;
|
|
397
409
|
if (env.CI !== "false") {
|
|
398
410
|
vendors.forEach(function(vendor) {
|
|
399
411
|
const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
|
|
400
412
|
const isCI2 = envs.every(function(obj) {
|
|
401
413
|
return checkEnv(obj);
|
|
402
414
|
});
|
|
403
|
-
exports[vendor.constant] = isCI2;
|
|
415
|
+
exports$1[vendor.constant] = isCI2;
|
|
404
416
|
if (!isCI2) {
|
|
405
417
|
return;
|
|
406
418
|
}
|
|
407
|
-
exports.name = vendor.name;
|
|
408
|
-
exports.isPR = checkPR(vendor);
|
|
409
|
-
exports.id = vendor.constant;
|
|
419
|
+
exports$1.name = vendor.name;
|
|
420
|
+
exports$1.isPR = checkPR(vendor);
|
|
421
|
+
exports$1.id = vendor.constant;
|
|
410
422
|
});
|
|
411
423
|
}
|
|
412
|
-
exports.isCI = !!(env.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
|
|
424
|
+
exports$1.isCI = !!(env.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
|
|
413
425
|
(env.BUILD_ID || // Jenkins, Cloudbees
|
|
414
426
|
env.BUILD_NUMBER || // Jenkins, TeamCity
|
|
415
427
|
env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari, Cloudflare Pages/Workers
|
|
@@ -419,7 +431,7 @@ var require_ci_info = __commonJS({
|
|
|
419
431
|
env.CI_NAME || // Codeship and others
|
|
420
432
|
env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
|
|
421
433
|
env.RUN_ID || // TaskCluster, dsari
|
|
422
|
-
exports.name || false));
|
|
434
|
+
exports$1.name || false));
|
|
423
435
|
function checkEnv(obj) {
|
|
424
436
|
if (typeof obj === "string") return !!env[obj];
|
|
425
437
|
if ("env" in obj) {
|
|
@@ -534,7 +546,7 @@ function isDocker2() {
|
|
|
534
546
|
}
|
|
535
547
|
__name(isDocker2, "isDocker");
|
|
536
548
|
|
|
537
|
-
// ../../node_modules/.
|
|
549
|
+
// ../../node_modules/.bun/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
|
|
538
550
|
var cachedResult;
|
|
539
551
|
var hasContainerEnv = /* @__PURE__ */ __name(() => {
|
|
540
552
|
try {
|
|
@@ -552,7 +564,7 @@ function isInsideContainer() {
|
|
|
552
564
|
}
|
|
553
565
|
__name(isInsideContainer, "isInsideContainer");
|
|
554
566
|
|
|
555
|
-
// ../../node_modules/.
|
|
567
|
+
// ../../node_modules/.bun/is-wsl@3.1.1/node_modules/is-wsl/index.js
|
|
556
568
|
var isWsl = /* @__PURE__ */ __name(() => {
|
|
557
569
|
if (process2.platform !== "linux") {
|
|
558
570
|
return false;
|
|
@@ -564,16 +576,21 @@ var isWsl = /* @__PURE__ */ __name(() => {
|
|
|
564
576
|
return true;
|
|
565
577
|
}
|
|
566
578
|
try {
|
|
567
|
-
|
|
579
|
+
if (fs.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
|
|
580
|
+
return !isInsideContainer();
|
|
581
|
+
}
|
|
568
582
|
} catch {
|
|
569
|
-
return false;
|
|
570
583
|
}
|
|
584
|
+
if (fs.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs.existsSync("/run/WSL")) {
|
|
585
|
+
return !isInsideContainer();
|
|
586
|
+
}
|
|
587
|
+
return false;
|
|
571
588
|
}, "isWsl");
|
|
572
589
|
var is_wsl_default = process2.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
573
590
|
|
|
574
591
|
// package.json
|
|
575
592
|
var package_default = {
|
|
576
|
-
version: "0.
|
|
593
|
+
version: "0.4.0"};
|
|
577
594
|
|
|
578
595
|
// src/config.ts
|
|
579
596
|
var CONFIG = {
|
|
@@ -819,10 +836,10 @@ __name(trackCommand, "trackCommand");
|
|
|
819
836
|
|
|
820
837
|
// src/cli/cli-executable.ts
|
|
821
838
|
var versionId = package_default.version;
|
|
822
|
-
function buildLazyCommand(
|
|
823
|
-
const commandName =
|
|
839
|
+
function buildLazyCommand(commandSpec9, loadCommandFn) {
|
|
840
|
+
const commandName = commandSpec9.name;
|
|
824
841
|
return {
|
|
825
|
-
...
|
|
842
|
+
...commandSpec9,
|
|
826
843
|
run: /* @__PURE__ */ __name(async (...args) => {
|
|
827
844
|
await trackCommand(commandName, { command: commandName });
|
|
828
845
|
const commandSpecAndFn = await loadCommandFn();
|
|
@@ -832,11 +849,14 @@ function buildLazyCommand(commandSpec6, loadCommandFn) {
|
|
|
832
849
|
}
|
|
833
850
|
__name(buildLazyCommand, "buildLazyCommand");
|
|
834
851
|
var subCommands = /* @__PURE__ */ new Map();
|
|
835
|
-
subCommands.set("init", buildLazyCommand(commandSpec, async () => await import('../init.command-
|
|
836
|
-
subCommands.set("load", buildLazyCommand(commandSpec$1, async () => await import('../load.command-
|
|
837
|
-
subCommands.set("run", buildLazyCommand(commandSpec$2, async () => await import('../run.command-
|
|
838
|
-
subCommands.set("
|
|
839
|
-
subCommands.set("
|
|
852
|
+
subCommands.set("init", buildLazyCommand(commandSpec, async () => await import('../init.command-FMHXUGDI.js')));
|
|
853
|
+
subCommands.set("load", buildLazyCommand(commandSpec$1, async () => await import('../load.command-6I2D5BPL.js')));
|
|
854
|
+
subCommands.set("run", buildLazyCommand(commandSpec$2, async () => await import('../run.command-4OJ6MBP6.js')));
|
|
855
|
+
subCommands.set("printenv", buildLazyCommand(commandSpec$3, async () => await import('../printenv.command-TROZTZ26.js')));
|
|
856
|
+
subCommands.set("help", buildLazyCommand(commandSpec$4, async () => await import('../help.command-7E52XAOO.js')));
|
|
857
|
+
subCommands.set("telemetry", buildLazyCommand(commandSpec$5, async () => await import('../telemetry.command-UZQSUYAY.js')));
|
|
858
|
+
subCommands.set("scan", buildLazyCommand(commandSpec$6, async () => await import('../scan.command-YRNAKUZT.js')));
|
|
859
|
+
subCommands.set("typegen", buildLazyCommand(commandSpec$7, async () => await import('../typegen.command-V4MATON4.js')));
|
|
840
860
|
(/* @__PURE__ */ __name(async function go() {
|
|
841
861
|
try {
|
|
842
862
|
let args = process.argv.slice(2);
|
|
@@ -868,10 +888,8 @@ subCommands.set("telemetry", buildLazyCommand(commandSpec$4, async () => await i
|
|
|
868
888
|
suggestion: `Run \`${fmt.command("varlock --help", { jsPackageManager: true })}\` for more info.`
|
|
869
889
|
});
|
|
870
890
|
console.error(badCommandErr.getFormattedOutput());
|
|
871
|
-
gracefulExit(1);
|
|
872
891
|
} else if (error instanceof CliExitError || error instanceof InvalidEnvError) {
|
|
873
892
|
console.error(error.getFormattedOutput());
|
|
874
|
-
gracefulExit(1);
|
|
875
893
|
} else {
|
|
876
894
|
throw error;
|
|
877
895
|
}
|