thinkwell 0.5.6 → 0.5.7
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/agent.d.ts.map +1 -1
- package/dist/agent.js +32 -6
- package/dist/agent.js.map +1 -1
- package/dist/cli/schema.d.ts.map +1 -1
- package/dist/cli/schema.js +4 -2
- package/dist/cli/schema.js.map +1 -1
- package/dist/generated/features.d.ts +2 -1
- package/dist/generated/features.d.ts.map +1 -1
- package/dist/generated/features.js +2 -1
- package/dist/generated/features.js.map +1 -1
- package/dist/think-builder.d.ts.map +1 -1
- package/dist/think-builder.js +25 -5
- package/dist/think-builder.js.map +1 -1
- package/dist-pkg/acp.cjs +2 -1
- package/dist-pkg/cli-build.cjs +110 -94
- package/dist-pkg/cli-bundle.cjs +196 -180
- package/dist-pkg/cli-check.cjs +128 -112
- package/dist-pkg/cli-loader.cjs +3 -2
- package/dist-pkg/thinkwell.cjs +58 -11
- package/package.json +6 -5
package/dist-pkg/cli-bundle.cjs
CHANGED
|
@@ -973,7 +973,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
973
973
|
let latestResultPromise;
|
|
974
974
|
let provideLatestResult;
|
|
975
975
|
if (isContext)
|
|
976
|
-
requestCallbacks["on-end"] = (id, request2) => new Promise((
|
|
976
|
+
requestCallbacks["on-end"] = (id, request2) => new Promise((resolve3) => {
|
|
977
977
|
buildResponseToResult(request2, (err, result, onEndErrors, onEndWarnings) => {
|
|
978
978
|
const response = {
|
|
979
979
|
errors: onEndErrors,
|
|
@@ -983,7 +983,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
983
983
|
latestResultPromise = void 0;
|
|
984
984
|
provideLatestResult = void 0;
|
|
985
985
|
sendResponse(id, response);
|
|
986
|
-
|
|
986
|
+
resolve3();
|
|
987
987
|
});
|
|
988
988
|
});
|
|
989
989
|
sendRequest(refs, request, (error, response) => {
|
|
@@ -1000,10 +1000,10 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
1000
1000
|
let didDispose = false;
|
|
1001
1001
|
const result = {
|
|
1002
1002
|
rebuild: /* @__PURE__ */ __name(() => {
|
|
1003
|
-
if (!latestResultPromise) latestResultPromise = new Promise((
|
|
1003
|
+
if (!latestResultPromise) latestResultPromise = new Promise((resolve3, reject) => {
|
|
1004
1004
|
let settlePromise;
|
|
1005
1005
|
provideLatestResult = /* @__PURE__ */ __name((err, result2) => {
|
|
1006
|
-
if (!settlePromise) settlePromise = /* @__PURE__ */ __name(() => err ? reject(err) :
|
|
1006
|
+
if (!settlePromise) settlePromise = /* @__PURE__ */ __name(() => err ? reject(err) : resolve3(result2), "settlePromise");
|
|
1007
1007
|
}, "provideLatestResult");
|
|
1008
1008
|
const triggerAnotherBuild = /* @__PURE__ */ __name(() => {
|
|
1009
1009
|
const request2 = {
|
|
@@ -1024,7 +1024,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
1024
1024
|
});
|
|
1025
1025
|
return latestResultPromise;
|
|
1026
1026
|
}, "rebuild"),
|
|
1027
|
-
watch: /* @__PURE__ */ __name((options2 = {}) => new Promise((
|
|
1027
|
+
watch: /* @__PURE__ */ __name((options2 = {}) => new Promise((resolve3, reject) => {
|
|
1028
1028
|
if (!streamIn.hasFS) throw new Error(`Cannot use the "watch" API in this environment`);
|
|
1029
1029
|
const keys = {};
|
|
1030
1030
|
const delay = getFlag(options2, keys, "delay", mustBeInteger);
|
|
@@ -1036,10 +1036,10 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
1036
1036
|
if (delay) request2.delay = delay;
|
|
1037
1037
|
sendRequest(refs, request2, (error2) => {
|
|
1038
1038
|
if (error2) reject(new Error(error2));
|
|
1039
|
-
else
|
|
1039
|
+
else resolve3(void 0);
|
|
1040
1040
|
});
|
|
1041
1041
|
}), "watch"),
|
|
1042
|
-
serve: /* @__PURE__ */ __name((options2 = {}) => new Promise((
|
|
1042
|
+
serve: /* @__PURE__ */ __name((options2 = {}) => new Promise((resolve3, reject) => {
|
|
1043
1043
|
if (!streamIn.hasFS) throw new Error(`Cannot use the "serve" API in this environment`);
|
|
1044
1044
|
const keys = {};
|
|
1045
1045
|
const port = getFlag(options2, keys, "port", mustBeValidPortNumber);
|
|
@@ -1077,28 +1077,28 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
1077
1077
|
sendResponse(id, {});
|
|
1078
1078
|
};
|
|
1079
1079
|
}
|
|
1080
|
-
|
|
1080
|
+
resolve3(response2);
|
|
1081
1081
|
});
|
|
1082
1082
|
}), "serve"),
|
|
1083
|
-
cancel: /* @__PURE__ */ __name(() => new Promise((
|
|
1084
|
-
if (didDispose) return
|
|
1083
|
+
cancel: /* @__PURE__ */ __name(() => new Promise((resolve3) => {
|
|
1084
|
+
if (didDispose) return resolve3();
|
|
1085
1085
|
const request2 = {
|
|
1086
1086
|
command: "cancel",
|
|
1087
1087
|
key: buildKey
|
|
1088
1088
|
};
|
|
1089
1089
|
sendRequest(refs, request2, () => {
|
|
1090
|
-
|
|
1090
|
+
resolve3();
|
|
1091
1091
|
});
|
|
1092
1092
|
}), "cancel"),
|
|
1093
|
-
dispose: /* @__PURE__ */ __name(() => new Promise((
|
|
1094
|
-
if (didDispose) return
|
|
1093
|
+
dispose: /* @__PURE__ */ __name(() => new Promise((resolve3) => {
|
|
1094
|
+
if (didDispose) return resolve3();
|
|
1095
1095
|
didDispose = true;
|
|
1096
1096
|
const request2 = {
|
|
1097
1097
|
command: "dispose",
|
|
1098
1098
|
key: buildKey
|
|
1099
1099
|
};
|
|
1100
1100
|
sendRequest(refs, request2, () => {
|
|
1101
|
-
|
|
1101
|
+
resolve3();
|
|
1102
1102
|
scheduleOnDisposeCallbacks();
|
|
1103
1103
|
refs.unref();
|
|
1104
1104
|
});
|
|
@@ -1139,7 +1139,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
1139
1139
|
onLoad: []
|
|
1140
1140
|
};
|
|
1141
1141
|
i++;
|
|
1142
|
-
let
|
|
1142
|
+
let resolve3 = /* @__PURE__ */ __name((path3, options = {}) => {
|
|
1143
1143
|
if (!isSetupDone) throw new Error('Cannot call "resolve" before plugin setup has completed');
|
|
1144
1144
|
if (typeof path3 !== "string") throw new Error(`The path to resolve must be a string`);
|
|
1145
1145
|
let keys2 = /* @__PURE__ */ Object.create(null);
|
|
@@ -1183,7 +1183,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
1183
1183
|
}, "resolve");
|
|
1184
1184
|
let promise = setup({
|
|
1185
1185
|
initialOptions,
|
|
1186
|
-
resolve:
|
|
1186
|
+
resolve: resolve3,
|
|
1187
1187
|
onStart(callback) {
|
|
1188
1188
|
let registeredText = `This error came from the "onStart" callback registered here:`;
|
|
1189
1189
|
let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onStart");
|
|
@@ -2077,46 +2077,46 @@ More information: The file containing the code for esbuild's JavaScript API (${_
|
|
|
2077
2077
|
}
|
|
2078
2078
|
};
|
|
2079
2079
|
longLivedService = {
|
|
2080
|
-
build: /* @__PURE__ */ __name((options) => new Promise((
|
|
2080
|
+
build: /* @__PURE__ */ __name((options) => new Promise((resolve3, reject) => {
|
|
2081
2081
|
service.buildOrContext({
|
|
2082
2082
|
callName: "build",
|
|
2083
2083
|
refs,
|
|
2084
2084
|
options,
|
|
2085
2085
|
isTTY: isTTY(),
|
|
2086
2086
|
defaultWD,
|
|
2087
|
-
callback: /* @__PURE__ */ __name((err, res) => err ? reject(err) :
|
|
2087
|
+
callback: /* @__PURE__ */ __name((err, res) => err ? reject(err) : resolve3(res), "callback")
|
|
2088
2088
|
});
|
|
2089
2089
|
}), "build"),
|
|
2090
|
-
context: /* @__PURE__ */ __name((options) => new Promise((
|
|
2090
|
+
context: /* @__PURE__ */ __name((options) => new Promise((resolve3, reject) => service.buildOrContext({
|
|
2091
2091
|
callName: "context",
|
|
2092
2092
|
refs,
|
|
2093
2093
|
options,
|
|
2094
2094
|
isTTY: isTTY(),
|
|
2095
2095
|
defaultWD,
|
|
2096
|
-
callback: /* @__PURE__ */ __name((err, res) => err ? reject(err) :
|
|
2096
|
+
callback: /* @__PURE__ */ __name((err, res) => err ? reject(err) : resolve3(res), "callback")
|
|
2097
2097
|
})), "context"),
|
|
2098
|
-
transform: /* @__PURE__ */ __name((input, options) => new Promise((
|
|
2098
|
+
transform: /* @__PURE__ */ __name((input, options) => new Promise((resolve3, reject) => service.transform({
|
|
2099
2099
|
callName: "transform",
|
|
2100
2100
|
refs,
|
|
2101
2101
|
input,
|
|
2102
2102
|
options: options || {},
|
|
2103
2103
|
isTTY: isTTY(),
|
|
2104
2104
|
fs: fsAsync,
|
|
2105
|
-
callback: /* @__PURE__ */ __name((err, res) => err ? reject(err) :
|
|
2105
|
+
callback: /* @__PURE__ */ __name((err, res) => err ? reject(err) : resolve3(res), "callback")
|
|
2106
2106
|
})), "transform"),
|
|
2107
|
-
formatMessages: /* @__PURE__ */ __name((messages, options) => new Promise((
|
|
2107
|
+
formatMessages: /* @__PURE__ */ __name((messages, options) => new Promise((resolve3, reject) => service.formatMessages({
|
|
2108
2108
|
callName: "formatMessages",
|
|
2109
2109
|
refs,
|
|
2110
2110
|
messages,
|
|
2111
2111
|
options,
|
|
2112
|
-
callback: /* @__PURE__ */ __name((err, res) => err ? reject(err) :
|
|
2112
|
+
callback: /* @__PURE__ */ __name((err, res) => err ? reject(err) : resolve3(res), "callback")
|
|
2113
2113
|
})), "formatMessages"),
|
|
2114
|
-
analyzeMetafile: /* @__PURE__ */ __name((metafile, options) => new Promise((
|
|
2114
|
+
analyzeMetafile: /* @__PURE__ */ __name((metafile, options) => new Promise((resolve3, reject) => service.analyzeMetafile({
|
|
2115
2115
|
callName: "analyzeMetafile",
|
|
2116
2116
|
refs,
|
|
2117
2117
|
metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile),
|
|
2118
2118
|
options,
|
|
2119
|
-
callback: /* @__PURE__ */ __name((err, res) => err ? reject(err) :
|
|
2119
|
+
callback: /* @__PURE__ */ __name((err, res) => err ? reject(err) : resolve3(res), "callback")
|
|
2120
2120
|
})), "analyzeMetafile")
|
|
2121
2121
|
};
|
|
2122
2122
|
return longLivedService;
|
|
@@ -2194,13 +2194,13 @@ error: ${text}`);
|
|
|
2194
2194
|
worker.postMessage(msg);
|
|
2195
2195
|
let status = Atomics.wait(sharedBufferView, 0, 0);
|
|
2196
2196
|
if (status !== "ok" && status !== "not-equal") throw new Error("Internal error: Atomics.wait() failed: " + status);
|
|
2197
|
-
let { message: { id: id2, resolve:
|
|
2197
|
+
let { message: { id: id2, resolve: resolve3, reject, properties } } = worker_threads2.receiveMessageOnPort(mainPort);
|
|
2198
2198
|
if (id !== id2) throw new Error(`Internal error: Expected id ${id} but got id ${id2}`);
|
|
2199
2199
|
if (reject) {
|
|
2200
2200
|
applyProperties(reject, properties);
|
|
2201
2201
|
throw reject;
|
|
2202
2202
|
}
|
|
2203
|
-
return
|
|
2203
|
+
return resolve3;
|
|
2204
2204
|
}, "runCallSync");
|
|
2205
2205
|
worker.unref();
|
|
2206
2206
|
return {
|
|
@@ -2781,16 +2781,16 @@ var require_typescript = __commonJS({
|
|
|
2781
2781
|
var tsp;
|
|
2782
2782
|
(function(tsp2) {
|
|
2783
2783
|
const activeProgramTransformers = /* @__PURE__ */ new Set();
|
|
2784
|
-
const { dirname:
|
|
2784
|
+
const { dirname: dirname5 } = require("path");
|
|
2785
2785
|
function getProjectDir(compilerOptions) {
|
|
2786
|
-
return compilerOptions.configFilePath &&
|
|
2786
|
+
return compilerOptions.configFilePath && dirname5(compilerOptions.configFilePath);
|
|
2787
2787
|
}
|
|
2788
2788
|
__name(getProjectDir, "getProjectDir");
|
|
2789
2789
|
function getProjectConfig(compilerOptions, rootFileNames) {
|
|
2790
2790
|
let configFilePath = compilerOptions.configFilePath;
|
|
2791
2791
|
let projectDir = getProjectDir(compilerOptions);
|
|
2792
2792
|
if (configFilePath === void 0) {
|
|
2793
|
-
const baseDir = rootFileNames.length > 0 ?
|
|
2793
|
+
const baseDir = rootFileNames.length > 0 ? dirname5(rootFileNames[0]) : projectDir ?? process.cwd();
|
|
2794
2794
|
configFilePath = tsp2.tsShim.findConfigFile(baseDir, tsp2.tsShim.sys.fileExists);
|
|
2795
2795
|
if (configFilePath) {
|
|
2796
2796
|
const config = readConfig(configFilePath);
|
|
@@ -2802,7 +2802,7 @@ var require_typescript = __commonJS({
|
|
|
2802
2802
|
}
|
|
2803
2803
|
__name(getProjectConfig, "getProjectConfig");
|
|
2804
2804
|
function readConfig(configFileNamePath) {
|
|
2805
|
-
const projectDir =
|
|
2805
|
+
const projectDir = dirname5(configFileNamePath);
|
|
2806
2806
|
const result = tsp2.tsShim.readConfigFile(configFileNamePath, tsp2.tsShim.sys.readFile);
|
|
2807
2807
|
if (result.error)
|
|
2808
2808
|
throw new tsp2.TsPatchError("Error in tsconfig.json: " + result.error.messageText);
|
|
@@ -133711,7 +133711,7 @@ ${lanes.join("\n")}
|
|
|
133711
133711
|
}
|
|
133712
133712
|
__name(createImportCallExpressionUMD, "createImportCallExpressionUMD");
|
|
133713
133713
|
function createImportCallExpressionAMD(arg, containsLexicalThis) {
|
|
133714
|
-
const
|
|
133714
|
+
const resolve3 = factory2.createUniqueName("resolve");
|
|
133715
133715
|
const reject = factory2.createUniqueName("reject");
|
|
133716
133716
|
const parameters = [
|
|
133717
133717
|
factory2.createParameterDeclaration(
|
|
@@ -133720,7 +133720,7 @@ ${lanes.join("\n")}
|
|
|
133720
133720
|
/*dotDotDotToken*/
|
|
133721
133721
|
void 0,
|
|
133722
133722
|
/*name*/
|
|
133723
|
-
|
|
133723
|
+
resolve3
|
|
133724
133724
|
),
|
|
133725
133725
|
factory2.createParameterDeclaration(
|
|
133726
133726
|
/*modifiers*/
|
|
@@ -133737,7 +133737,7 @@ ${lanes.join("\n")}
|
|
|
133737
133737
|
factory2.createIdentifier("require"),
|
|
133738
133738
|
/*typeArguments*/
|
|
133739
133739
|
void 0,
|
|
133740
|
-
[factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]),
|
|
133740
|
+
[factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve3, reject]
|
|
133741
133741
|
)
|
|
133742
133742
|
)
|
|
133743
133743
|
]);
|
|
@@ -147273,10 +147273,10 @@ ${lanes.join("\n")}
|
|
|
147273
147273
|
/*ignoreCase*/
|
|
147274
147274
|
false
|
|
147275
147275
|
)) {
|
|
147276
|
-
const
|
|
147277
|
-
if (
|
|
147276
|
+
const basename3 = getBaseFileName(a.fileName);
|
|
147277
|
+
if (basename3 === "lib.d.ts" || basename3 === "lib.es6.d.ts")
|
|
147278
147278
|
return 0;
|
|
147279
|
-
const name = removeSuffix(removePrefix(
|
|
147279
|
+
const name = removeSuffix(removePrefix(basename3, "lib."), ".d.ts");
|
|
147280
147280
|
const index = libs.indexOf(name);
|
|
147281
147281
|
if (index !== -1)
|
|
147282
147282
|
return index + 1;
|
|
@@ -214049,8 +214049,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
214049
214049
|
}
|
|
214050
214050
|
}, "createProjectWatcher");
|
|
214051
214051
|
for (const file of files) {
|
|
214052
|
-
const
|
|
214053
|
-
if (
|
|
214052
|
+
const basename3 = getBaseFileName(file);
|
|
214053
|
+
if (basename3 === "package.json" || basename3 === "bower.json") {
|
|
214054
214054
|
createProjectWatcher(
|
|
214055
214055
|
file,
|
|
214056
214056
|
"FileWatcher"
|
|
@@ -217796,8 +217796,8 @@ All files are: ${JSON.stringify(names)}`,
|
|
|
217796
217796
|
var _a;
|
|
217797
217797
|
const fileOrDirectoryPath = removeIgnoredPath(this.toPath(fileOrDirectory));
|
|
217798
217798
|
if (!fileOrDirectoryPath) return;
|
|
217799
|
-
const
|
|
217800
|
-
if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size) && (
|
|
217799
|
+
const basename3 = getBaseFileName(fileOrDirectoryPath);
|
|
217800
|
+
if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size) && (basename3 === "package.json" || basename3 === "node_modules")) {
|
|
217801
217801
|
result.affectedModuleSpecifierCacheProjects.forEach((project) => {
|
|
217802
217802
|
var _a2;
|
|
217803
217803
|
(_a2 = project.getModuleSpecifierCache()) == null ? void 0 : _a2.clear();
|
|
@@ -224383,8 +224383,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
224383
224383
|
installPackage(options) {
|
|
224384
224384
|
this.packageInstallId++;
|
|
224385
224385
|
const request = { kind: "installPackage", ...options, id: this.packageInstallId };
|
|
224386
|
-
const promise = new Promise((
|
|
224387
|
-
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve:
|
|
224386
|
+
const promise = new Promise((resolve3, reject) => {
|
|
224387
|
+
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve3, reject });
|
|
224388
224388
|
});
|
|
224389
224389
|
this.installer.send(request);
|
|
224390
224390
|
return promise;
|
|
@@ -224787,12 +224787,12 @@ function __metadata(metadataKey, metadataValue) {
|
|
|
224787
224787
|
}
|
|
224788
224788
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
224789
224789
|
function adopt(value) {
|
|
224790
|
-
return value instanceof P ? value : new P(function(
|
|
224791
|
-
|
|
224790
|
+
return value instanceof P ? value : new P(function(resolve3) {
|
|
224791
|
+
resolve3(value);
|
|
224792
224792
|
});
|
|
224793
224793
|
}
|
|
224794
224794
|
__name(adopt, "adopt");
|
|
224795
|
-
return new (P || (P = Promise))(function(
|
|
224795
|
+
return new (P || (P = Promise))(function(resolve3, reject) {
|
|
224796
224796
|
function fulfilled(value) {
|
|
224797
224797
|
try {
|
|
224798
224798
|
step(generator.next(value));
|
|
@@ -224810,7 +224810,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
224810
224810
|
}
|
|
224811
224811
|
__name(rejected, "rejected");
|
|
224812
224812
|
function step(result) {
|
|
224813
|
-
result.done ?
|
|
224813
|
+
result.done ? resolve3(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
224814
224814
|
}
|
|
224815
224815
|
__name(step, "step");
|
|
224816
224816
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
@@ -225012,15 +225012,15 @@ function __asyncValues(o) {
|
|
|
225012
225012
|
}, i);
|
|
225013
225013
|
function verb(n) {
|
|
225014
225014
|
i[n] = o[n] && function(v) {
|
|
225015
|
-
return new Promise(function(
|
|
225016
|
-
v = o[n](v), settle(
|
|
225015
|
+
return new Promise(function(resolve3, reject) {
|
|
225016
|
+
v = o[n](v), settle(resolve3, reject, v.done, v.value);
|
|
225017
225017
|
});
|
|
225018
225018
|
};
|
|
225019
225019
|
}
|
|
225020
225020
|
__name(verb, "verb");
|
|
225021
|
-
function settle(
|
|
225021
|
+
function settle(resolve3, reject, d, v) {
|
|
225022
225022
|
Promise.resolve(v).then(function(v2) {
|
|
225023
|
-
|
|
225023
|
+
resolve3({ value: v2, done: d });
|
|
225024
225024
|
}, reject);
|
|
225025
225025
|
}
|
|
225026
225026
|
__name(settle, "settle");
|
|
@@ -225668,7 +225668,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
225668
225668
|
return circularValue;
|
|
225669
225669
|
}
|
|
225670
225670
|
let res = "";
|
|
225671
|
-
let
|
|
225671
|
+
let join7 = ",";
|
|
225672
225672
|
const originalIndentation = indentation;
|
|
225673
225673
|
if (Array.isArray(value)) {
|
|
225674
225674
|
if (value.length === 0) {
|
|
@@ -225682,7 +225682,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
225682
225682
|
indentation += spacer;
|
|
225683
225683
|
res += `
|
|
225684
225684
|
${indentation}`;
|
|
225685
|
-
|
|
225685
|
+
join7 = `,
|
|
225686
225686
|
${indentation}`;
|
|
225687
225687
|
}
|
|
225688
225688
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -225690,13 +225690,13 @@ ${indentation}`;
|
|
|
225690
225690
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
225691
225691
|
const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
225692
225692
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
225693
|
-
res +=
|
|
225693
|
+
res += join7;
|
|
225694
225694
|
}
|
|
225695
225695
|
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
225696
225696
|
res += tmp !== void 0 ? tmp : "null";
|
|
225697
225697
|
if (value.length - 1 > maximumBreadth) {
|
|
225698
225698
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
225699
|
-
res += `${
|
|
225699
|
+
res += `${join7}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
225700
225700
|
}
|
|
225701
225701
|
if (spacer !== "") {
|
|
225702
225702
|
res += `
|
|
@@ -225717,7 +225717,7 @@ ${originalIndentation}`;
|
|
|
225717
225717
|
let separator = "";
|
|
225718
225718
|
if (spacer !== "") {
|
|
225719
225719
|
indentation += spacer;
|
|
225720
|
-
|
|
225720
|
+
join7 = `,
|
|
225721
225721
|
${indentation}`;
|
|
225722
225722
|
whitespace = " ";
|
|
225723
225723
|
}
|
|
@@ -225731,13 +225731,13 @@ ${indentation}`;
|
|
|
225731
225731
|
const tmp = stringifyFnReplacer(key3, value, stack, replacer, spacer, indentation);
|
|
225732
225732
|
if (tmp !== void 0) {
|
|
225733
225733
|
res += `${separator}${strEscape(key3)}:${whitespace}${tmp}`;
|
|
225734
|
-
separator =
|
|
225734
|
+
separator = join7;
|
|
225735
225735
|
}
|
|
225736
225736
|
}
|
|
225737
225737
|
if (keyLength > maximumBreadth) {
|
|
225738
225738
|
const removedKeys = keyLength - maximumBreadth;
|
|
225739
225739
|
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
|
225740
|
-
separator =
|
|
225740
|
+
separator = join7;
|
|
225741
225741
|
}
|
|
225742
225742
|
if (spacer !== "" && separator.length > 1) {
|
|
225743
225743
|
res = `
|
|
@@ -225779,7 +225779,7 @@ ${originalIndentation}`;
|
|
|
225779
225779
|
}
|
|
225780
225780
|
const originalIndentation = indentation;
|
|
225781
225781
|
let res = "";
|
|
225782
|
-
let
|
|
225782
|
+
let join7 = ",";
|
|
225783
225783
|
if (Array.isArray(value)) {
|
|
225784
225784
|
if (value.length === 0) {
|
|
225785
225785
|
return "[]";
|
|
@@ -225792,7 +225792,7 @@ ${originalIndentation}`;
|
|
|
225792
225792
|
indentation += spacer;
|
|
225793
225793
|
res += `
|
|
225794
225794
|
${indentation}`;
|
|
225795
|
-
|
|
225795
|
+
join7 = `,
|
|
225796
225796
|
${indentation}`;
|
|
225797
225797
|
}
|
|
225798
225798
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -225800,13 +225800,13 @@ ${indentation}`;
|
|
|
225800
225800
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
225801
225801
|
const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
225802
225802
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
225803
|
-
res +=
|
|
225803
|
+
res += join7;
|
|
225804
225804
|
}
|
|
225805
225805
|
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
225806
225806
|
res += tmp !== void 0 ? tmp : "null";
|
|
225807
225807
|
if (value.length - 1 > maximumBreadth) {
|
|
225808
225808
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
225809
|
-
res += `${
|
|
225809
|
+
res += `${join7}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
225810
225810
|
}
|
|
225811
225811
|
if (spacer !== "") {
|
|
225812
225812
|
res += `
|
|
@@ -225819,7 +225819,7 @@ ${originalIndentation}`;
|
|
|
225819
225819
|
let whitespace = "";
|
|
225820
225820
|
if (spacer !== "") {
|
|
225821
225821
|
indentation += spacer;
|
|
225822
|
-
|
|
225822
|
+
join7 = `,
|
|
225823
225823
|
${indentation}`;
|
|
225824
225824
|
whitespace = " ";
|
|
225825
225825
|
}
|
|
@@ -225828,7 +225828,7 @@ ${indentation}`;
|
|
|
225828
225828
|
const tmp = stringifyArrayReplacer(key3, value[key3], stack, replacer, spacer, indentation);
|
|
225829
225829
|
if (tmp !== void 0) {
|
|
225830
225830
|
res += `${separator}${strEscape(key3)}:${whitespace}${tmp}`;
|
|
225831
|
-
separator =
|
|
225831
|
+
separator = join7;
|
|
225832
225832
|
}
|
|
225833
225833
|
}
|
|
225834
225834
|
if (spacer !== "" && separator.length > 1) {
|
|
@@ -225887,20 +225887,20 @@ ${originalIndentation}`;
|
|
|
225887
225887
|
indentation += spacer;
|
|
225888
225888
|
let res2 = `
|
|
225889
225889
|
${indentation}`;
|
|
225890
|
-
const
|
|
225890
|
+
const join8 = `,
|
|
225891
225891
|
${indentation}`;
|
|
225892
225892
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
225893
225893
|
let i = 0;
|
|
225894
225894
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
225895
225895
|
const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
225896
225896
|
res2 += tmp2 !== void 0 ? tmp2 : "null";
|
|
225897
|
-
res2 +=
|
|
225897
|
+
res2 += join8;
|
|
225898
225898
|
}
|
|
225899
225899
|
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
225900
225900
|
res2 += tmp !== void 0 ? tmp : "null";
|
|
225901
225901
|
if (value.length - 1 > maximumBreadth) {
|
|
225902
225902
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
225903
|
-
res2 += `${
|
|
225903
|
+
res2 += `${join8}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
225904
225904
|
}
|
|
225905
225905
|
res2 += `
|
|
225906
225906
|
${originalIndentation}`;
|
|
@@ -225916,16 +225916,16 @@ ${originalIndentation}`;
|
|
|
225916
225916
|
return '"[Object]"';
|
|
225917
225917
|
}
|
|
225918
225918
|
indentation += spacer;
|
|
225919
|
-
const
|
|
225919
|
+
const join7 = `,
|
|
225920
225920
|
${indentation}`;
|
|
225921
225921
|
let res = "";
|
|
225922
225922
|
let separator = "";
|
|
225923
225923
|
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
225924
225924
|
if (isTypedArrayWithEntries(value)) {
|
|
225925
|
-
res += stringifyTypedArray(value,
|
|
225925
|
+
res += stringifyTypedArray(value, join7, maximumBreadth);
|
|
225926
225926
|
keys = keys.slice(value.length);
|
|
225927
225927
|
maximumPropertiesToStringify -= value.length;
|
|
225928
|
-
separator =
|
|
225928
|
+
separator = join7;
|
|
225929
225929
|
}
|
|
225930
225930
|
if (deterministic) {
|
|
225931
225931
|
keys = sort(keys, comparator);
|
|
@@ -225936,13 +225936,13 @@ ${indentation}`;
|
|
|
225936
225936
|
const tmp = stringifyIndent(key3, value[key3], stack, spacer, indentation);
|
|
225937
225937
|
if (tmp !== void 0) {
|
|
225938
225938
|
res += `${separator}${strEscape(key3)}: ${tmp}`;
|
|
225939
|
-
separator =
|
|
225939
|
+
separator = join7;
|
|
225940
225940
|
}
|
|
225941
225941
|
}
|
|
225942
225942
|
if (keyLength > maximumBreadth) {
|
|
225943
225943
|
const removedKeys = keyLength - maximumBreadth;
|
|
225944
225944
|
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
225945
|
-
separator =
|
|
225945
|
+
separator = join7;
|
|
225946
225946
|
}
|
|
225947
225947
|
if (separator !== "") {
|
|
225948
225948
|
res = `
|
|
@@ -237417,10 +237417,10 @@ var require_commonjs5 = __commonJS({
|
|
|
237417
237417
|
* Return a void Promise that resolves once the stream ends.
|
|
237418
237418
|
*/
|
|
237419
237419
|
async promise() {
|
|
237420
|
-
return new Promise((
|
|
237420
|
+
return new Promise((resolve3, reject) => {
|
|
237421
237421
|
this.on(DESTROYED, () => reject(new Error("stream destroyed")));
|
|
237422
237422
|
this.on("error", (er) => reject(er));
|
|
237423
|
-
this.on("end", () =>
|
|
237423
|
+
this.on("end", () => resolve3());
|
|
237424
237424
|
});
|
|
237425
237425
|
}
|
|
237426
237426
|
/**
|
|
@@ -237444,7 +237444,7 @@ var require_commonjs5 = __commonJS({
|
|
|
237444
237444
|
return Promise.resolve({ done: false, value: res });
|
|
237445
237445
|
if (this[EOF])
|
|
237446
237446
|
return stop();
|
|
237447
|
-
let
|
|
237447
|
+
let resolve3;
|
|
237448
237448
|
let reject;
|
|
237449
237449
|
const onerr = /* @__PURE__ */ __name((er) => {
|
|
237450
237450
|
this.off("data", ondata);
|
|
@@ -237458,19 +237458,19 @@ var require_commonjs5 = __commonJS({
|
|
|
237458
237458
|
this.off("end", onend);
|
|
237459
237459
|
this.off(DESTROYED, ondestroy);
|
|
237460
237460
|
this.pause();
|
|
237461
|
-
|
|
237461
|
+
resolve3({ value, done: !!this[EOF] });
|
|
237462
237462
|
}, "ondata");
|
|
237463
237463
|
const onend = /* @__PURE__ */ __name(() => {
|
|
237464
237464
|
this.off("error", onerr);
|
|
237465
237465
|
this.off("data", ondata);
|
|
237466
237466
|
this.off(DESTROYED, ondestroy);
|
|
237467
237467
|
stop();
|
|
237468
|
-
|
|
237468
|
+
resolve3({ done: true, value: void 0 });
|
|
237469
237469
|
}, "onend");
|
|
237470
237470
|
const ondestroy = /* @__PURE__ */ __name(() => onerr(new Error("stream destroyed")), "ondestroy");
|
|
237471
237471
|
return new Promise((res2, rej) => {
|
|
237472
237472
|
reject = rej;
|
|
237473
|
-
|
|
237473
|
+
resolve3 = res2;
|
|
237474
237474
|
this.once(DESTROYED, ondestroy);
|
|
237475
237475
|
this.once("error", onerr);
|
|
237476
237476
|
this.once("end", onend);
|
|
@@ -238495,9 +238495,9 @@ var require_commonjs6 = __commonJS({
|
|
|
238495
238495
|
if (this.#asyncReaddirInFlight) {
|
|
238496
238496
|
await this.#asyncReaddirInFlight;
|
|
238497
238497
|
} else {
|
|
238498
|
-
let
|
|
238498
|
+
let resolve3 = /* @__PURE__ */ __name(() => {
|
|
238499
238499
|
}, "resolve");
|
|
238500
|
-
this.#asyncReaddirInFlight = new Promise((res) =>
|
|
238500
|
+
this.#asyncReaddirInFlight = new Promise((res) => resolve3 = res);
|
|
238501
238501
|
try {
|
|
238502
238502
|
for (const e of await this.#fs.promises.readdir(fullpath, {
|
|
238503
238503
|
withFileTypes: true
|
|
@@ -238510,7 +238510,7 @@ var require_commonjs6 = __commonJS({
|
|
|
238510
238510
|
children.provisional = 0;
|
|
238511
238511
|
}
|
|
238512
238512
|
this.#asyncReaddirInFlight = void 0;
|
|
238513
|
-
|
|
238513
|
+
resolve3();
|
|
238514
238514
|
}
|
|
238515
238515
|
return children.slice(0, children.provisional);
|
|
238516
238516
|
}
|
|
@@ -240851,8 +240851,8 @@ __export(bundle_exports, {
|
|
|
240851
240851
|
showBundleHelp: () => showBundleHelp
|
|
240852
240852
|
});
|
|
240853
240853
|
module.exports = __toCommonJS(bundle_exports);
|
|
240854
|
-
var
|
|
240855
|
-
var
|
|
240854
|
+
var import_node_fs5 = require("node:fs");
|
|
240855
|
+
var import_node_path6 = require("node:path");
|
|
240856
240856
|
var import_node_url = require("node:url");
|
|
240857
240857
|
var import_node_util2 = require("node:util");
|
|
240858
240858
|
var import_node_os = require("node:os");
|
|
@@ -240866,14 +240866,14 @@ var whiteBold = /* @__PURE__ */ __name((t) => (0, import_node_util.styleText)(["
|
|
|
240866
240866
|
var dim = /* @__PURE__ */ __name((t) => (0, import_node_util.styleText)("dim", t), "dim");
|
|
240867
240867
|
|
|
240868
240868
|
// dist/cli/bundle.js
|
|
240869
|
-
var
|
|
240869
|
+
var import_node_crypto2 = require("node:crypto");
|
|
240870
240870
|
var import_node_child_process2 = require("node:child_process");
|
|
240871
240871
|
var esbuild = __toESM(require_main(), 1);
|
|
240872
240872
|
|
|
240873
240873
|
// dist/cli/schema.js
|
|
240874
240874
|
var import_typescript = __toESM(require_typescript(), 1);
|
|
240875
|
-
var
|
|
240876
|
-
var
|
|
240875
|
+
var import_node_path3 = require("node:path");
|
|
240876
|
+
var import_node_module2 = require("node:module");
|
|
240877
240877
|
|
|
240878
240878
|
// dist/build.js
|
|
240879
240879
|
var import_node_path = require("node:path");
|
|
@@ -240937,6 +240937,21 @@ function generateSchemas(filePath, typeNames) {
|
|
|
240937
240937
|
}
|
|
240938
240938
|
__name(generateSchemas, "generateSchemas");
|
|
240939
240939
|
|
|
240940
|
+
// dist/cli/loader.js
|
|
240941
|
+
var import_node_fs2 = require("node:fs");
|
|
240942
|
+
var import_node_path2 = require("node:path");
|
|
240943
|
+
var import_node_crypto = require("node:crypto");
|
|
240944
|
+
var import_node_module = require("node:module");
|
|
240945
|
+
function extractShebang(source) {
|
|
240946
|
+
if (source.startsWith("#!")) {
|
|
240947
|
+
const newlineIndex = source.indexOf(`
|
|
240948
|
+
`);
|
|
240949
|
+
return newlineIndex !== -1 ? [source.slice(0, newlineIndex + 1), source.slice(newlineIndex + 1)] : [source, ""];
|
|
240950
|
+
}
|
|
240951
|
+
return ["", source];
|
|
240952
|
+
}
|
|
240953
|
+
__name(extractShebang, "extractShebang");
|
|
240954
|
+
|
|
240940
240955
|
// dist/cli/schema.js
|
|
240941
240956
|
var JSONSCHEMA_TAG = "JSONSchema";
|
|
240942
240957
|
function hasJsDocTag(node, tagName) {
|
|
@@ -240977,7 +240992,7 @@ function findMarkedTypes(path, source) {
|
|
|
240977
240992
|
__name(findMarkedTypes, "findMarkedTypes");
|
|
240978
240993
|
function resolveGenerateSchemas(projectDir) {
|
|
240979
240994
|
if (projectDir) {
|
|
240980
|
-
const buildMod = (0,
|
|
240995
|
+
const buildMod = (0, import_node_module2.createRequire)((0, import_node_path3.join)(projectDir, "package.json"))("thinkwell/build");
|
|
240981
240996
|
if (typeof buildMod.generateSchemas == "function")
|
|
240982
240997
|
return buildMod.generateSchemas;
|
|
240983
240998
|
throw new Error(`thinkwell/build resolved from ${projectDir} but does not export generateSchemas. This may indicate a version mismatch \u2014 try updating the thinkwell dependency.`);
|
|
@@ -241056,19 +241071,20 @@ function transformJsonSchemas(path, source, projectDir) {
|
|
|
241056
241071
|
return source;
|
|
241057
241072
|
const schemas = generateSchemas2(path, markedTypes, source, projectDir), insertions = generateInsertions(markedTypes, schemas);
|
|
241058
241073
|
let modifiedSource = applyInsertions(source, insertions);
|
|
241059
|
-
|
|
241060
|
-
|
|
241074
|
+
const [shebang, rest] = extractShebang(modifiedSource);
|
|
241075
|
+
return modifiedSource = shebang + generateSchemaImport() + `
|
|
241076
|
+
` + rest, modifiedSource;
|
|
241061
241077
|
}
|
|
241062
241078
|
__name(transformJsonSchemas, "transformJsonSchemas");
|
|
241063
241079
|
|
|
241064
241080
|
// dist/cli/dependency-check.js
|
|
241065
|
-
var
|
|
241066
|
-
var
|
|
241081
|
+
var import_node_fs4 = require("node:fs");
|
|
241082
|
+
var import_node_path5 = require("node:path");
|
|
241067
241083
|
var import_node_child_process = require("node:child_process");
|
|
241068
241084
|
|
|
241069
241085
|
// dist/cli/package-manager.js
|
|
241070
|
-
var
|
|
241071
|
-
var
|
|
241086
|
+
var import_node_fs3 = require("node:fs");
|
|
241087
|
+
var import_node_path4 = require("node:path");
|
|
241072
241088
|
var LOCKFILES = [
|
|
241073
241089
|
{ file: "pnpm-lock.yaml", pm: "pnpm" },
|
|
241074
241090
|
{ file: "yarn.lock", pm: "yarn" },
|
|
@@ -241076,8 +241092,8 @@ var LOCKFILES = [
|
|
|
241076
241092
|
];
|
|
241077
241093
|
function detectByLockfile(projectDir) {
|
|
241078
241094
|
for (const { file, pm } of LOCKFILES) {
|
|
241079
|
-
const lockfilePath = (0,
|
|
241080
|
-
if ((0,
|
|
241095
|
+
const lockfilePath = (0, import_node_path4.join)(projectDir, file);
|
|
241096
|
+
if ((0, import_node_fs3.existsSync)(lockfilePath))
|
|
241081
241097
|
return { pm, lockfile: file };
|
|
241082
241098
|
}
|
|
241083
241099
|
return null;
|
|
@@ -241091,11 +241107,11 @@ function parsePackageManagerField(value) {
|
|
|
241091
241107
|
}
|
|
241092
241108
|
__name(parsePackageManagerField, "parsePackageManagerField");
|
|
241093
241109
|
function detectByPackageJson(projectDir) {
|
|
241094
|
-
const pkgPath = (0,
|
|
241095
|
-
if (!(0,
|
|
241110
|
+
const pkgPath = (0, import_node_path4.join)(projectDir, "package.json");
|
|
241111
|
+
if (!(0, import_node_fs3.existsSync)(pkgPath))
|
|
241096
241112
|
return null;
|
|
241097
241113
|
try {
|
|
241098
|
-
const content = (0,
|
|
241114
|
+
const content = (0, import_node_fs3.readFileSync)(pkgPath, "utf-8"), pkg = JSON.parse(content);
|
|
241099
241115
|
return parsePackageManagerField(pkg.packageManager);
|
|
241100
241116
|
} catch {
|
|
241101
241117
|
return null;
|
|
@@ -241140,11 +241156,11 @@ __name(detectPackageManager, "detectPackageManager");
|
|
|
241140
241156
|
|
|
241141
241157
|
// dist/cli/dependency-check.js
|
|
241142
241158
|
function readPackageJson(dir) {
|
|
241143
|
-
const pkgPath = (0,
|
|
241144
|
-
if (!(0,
|
|
241159
|
+
const pkgPath = (0, import_node_path5.join)(dir, "package.json");
|
|
241160
|
+
if (!(0, import_node_fs4.existsSync)(pkgPath))
|
|
241145
241161
|
return null;
|
|
241146
241162
|
try {
|
|
241147
|
-
const content = (0,
|
|
241163
|
+
const content = (0, import_node_fs4.readFileSync)(pkgPath, "utf-8");
|
|
241148
241164
|
return JSON.parse(content);
|
|
241149
241165
|
} catch {
|
|
241150
241166
|
return null;
|
|
@@ -241169,7 +241185,7 @@ function checkPackageJsonDirect(pkg, packageName) {
|
|
|
241169
241185
|
}
|
|
241170
241186
|
__name(checkPackageJsonDirect, "checkPackageJsonDirect");
|
|
241171
241187
|
function execCommand(cmd, cwd) {
|
|
241172
|
-
return new Promise((
|
|
241188
|
+
return new Promise((resolve3, reject) => {
|
|
241173
241189
|
const [command, ...args] = cmd, proc = (0, import_node_child_process.spawn)(command, args, {
|
|
241174
241190
|
cwd,
|
|
241175
241191
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -241182,7 +241198,7 @@ function execCommand(cmd, cwd) {
|
|
|
241182
241198
|
}), proc.on("error", (err) => {
|
|
241183
241199
|
reject(err);
|
|
241184
241200
|
}), proc.on("close", (code) => {
|
|
241185
|
-
code === 0 ?
|
|
241201
|
+
code === 0 ? resolve3({ stdout, stderr }) : reject(new Error(`Command failed with exit code ${code}: ${stderr}`));
|
|
241186
241202
|
});
|
|
241187
241203
|
});
|
|
241188
241204
|
}
|
|
@@ -241284,9 +241300,9 @@ __name(checkDependencies, "checkDependencies");
|
|
|
241284
241300
|
function findProjectRoot(startDir) {
|
|
241285
241301
|
let dir = startDir;
|
|
241286
241302
|
for (; ; ) {
|
|
241287
|
-
if ((0,
|
|
241303
|
+
if ((0, import_node_fs4.existsSync)((0, import_node_path5.join)(dir, "package.json")))
|
|
241288
241304
|
return dir;
|
|
241289
|
-
const parent = (0,
|
|
241305
|
+
const parent = (0, import_node_path5.dirname)(dir);
|
|
241290
241306
|
if (parent === dir)
|
|
241291
241307
|
return;
|
|
241292
241308
|
dir = parent;
|
|
@@ -241363,7 +241379,7 @@ function createSpinnerImpl(options) {
|
|
|
241363
241379
|
};
|
|
241364
241380
|
}
|
|
241365
241381
|
__name(createSpinnerImpl, "createSpinnerImpl");
|
|
241366
|
-
var __dirname2 = typeof import_meta?.url == "string" ? (0,
|
|
241382
|
+
var __dirname2 = typeof import_meta?.url == "string" ? (0, import_node_path6.dirname)((0, import_node_url.fileURLToPath)(import_meta.url)) : globalThis.__dirname || (0, import_node_path6.dirname)(process.argv[1]);
|
|
241367
241383
|
var TARGET_MAP = {
|
|
241368
241384
|
"darwin-arm64": "node24-macos-arm64",
|
|
241369
241385
|
"darwin-x64": "node24-macos-x64",
|
|
@@ -241384,10 +241400,10 @@ function detectHostTarget() {
|
|
|
241384
241400
|
}
|
|
241385
241401
|
__name(detectHostTarget, "detectHostTarget");
|
|
241386
241402
|
function readPackageJsonConfig(dir) {
|
|
241387
|
-
const pkgPath = (0,
|
|
241388
|
-
if ((0,
|
|
241403
|
+
const pkgPath = (0, import_node_path6.join)(dir, "package.json");
|
|
241404
|
+
if ((0, import_node_fs5.existsSync)(pkgPath))
|
|
241389
241405
|
try {
|
|
241390
|
-
const content = (0,
|
|
241406
|
+
const content = (0, import_node_fs5.readFileSync)(pkgPath, "utf-8"), config = JSON.parse(content)?.thinkwell?.bundle;
|
|
241391
241407
|
if (!config || typeof config != "object")
|
|
241392
241408
|
return;
|
|
241393
241409
|
const result = {};
|
|
@@ -241473,18 +241489,18 @@ function parseBundleArgs(args) {
|
|
|
241473
241489
|
}
|
|
241474
241490
|
__name(parseBundleArgs, "parseBundleArgs");
|
|
241475
241491
|
function initBundleContext(options) {
|
|
241476
|
-
const entryPath = (0,
|
|
241477
|
-
if (!(0,
|
|
241492
|
+
const entryPath = (0, import_node_path6.isAbsolute)(options.entry) ? options.entry : (0, import_node_path6.resolve)(process.cwd(), options.entry);
|
|
241493
|
+
if (!(0, import_node_fs5.existsSync)(entryPath)) {
|
|
241478
241494
|
const suggestion = options.entry.endsWith(".ts") || options.entry.endsWith(".js") ? "" : `
|
|
241479
241495
|
Did you mean to add a .ts or .js extension?`;
|
|
241480
241496
|
throw new Error(`Entry file not found: ${options.entry}${suggestion}
|
|
241481
241497
|
Working directory: ${process.cwd()}`);
|
|
241482
241498
|
}
|
|
241483
|
-
const entryBasename = (0,
|
|
241499
|
+
const entryBasename = (0, import_node_path6.basename)(entryPath).replace(/\.(ts|js|mts|mjs|cts|cjs)$/, ""), entryDir = (0, import_node_path6.dirname)(entryPath);
|
|
241484
241500
|
let mergedOptions = mergeWithPackageConfig(options, entryDir);
|
|
241485
241501
|
entryDir !== process.cwd() && (mergedOptions = mergeWithPackageConfig(mergedOptions, process.cwd()));
|
|
241486
|
-
const buildDir = (0,
|
|
241487
|
-
if (!(0,
|
|
241502
|
+
const buildDir = (0, import_node_fs5.mkdtempSync)((0, import_node_path6.join)((0, import_node_os.tmpdir)(), `thinkwell-bundle-${entryBasename}-`)), thinkwellDistPkg = (0, import_node_path6.resolve)(__dirname2, "../../dist-pkg");
|
|
241503
|
+
if (!(0, import_node_fs5.existsSync)(thinkwellDistPkg))
|
|
241488
241504
|
throw new Error(`Thinkwell dist-pkg not found at ${thinkwellDistPkg}.
|
|
241489
241505
|
This may indicate a corrupted installation.
|
|
241490
241506
|
Try reinstalling thinkwell: npm install thinkwell`);
|
|
@@ -241501,7 +241517,7 @@ function initBundleContext(options) {
|
|
|
241501
241517
|
}
|
|
241502
241518
|
__name(initBundleContext, "initBundleContext");
|
|
241503
241519
|
function getOutputPath(ctx, target2) {
|
|
241504
|
-
return ctx.options.output ? ctx.resolvedTargets.length === 1 ? (0,
|
|
241520
|
+
return ctx.options.output ? ctx.resolvedTargets.length === 1 ? (0, import_node_path6.isAbsolute)(ctx.options.output) ? ctx.options.output : (0, import_node_path6.resolve)(process.cwd(), ctx.options.output) : `${(0, import_node_path6.isAbsolute)(ctx.options.output) ? ctx.options.output : (0, import_node_path6.resolve)(process.cwd(), ctx.options.output)}-${target2}` : (0, import_node_path6.resolve)(process.cwd(), `${ctx.entryBasename}-${target2}`);
|
|
241505
241521
|
}
|
|
241506
241522
|
__name(getOutputPath, "getOutputPath");
|
|
241507
241523
|
function generateWrapperSource(userBundlePath) {
|
|
@@ -241523,12 +241539,12 @@ global.__bundled__ = {
|
|
|
241523
241539
|
};
|
|
241524
241540
|
|
|
241525
241541
|
// Load the user's bundled code
|
|
241526
|
-
require('./${(0,
|
|
241542
|
+
require('./${(0, import_node_path6.basename)(userBundlePath)}');
|
|
241527
241543
|
`;
|
|
241528
241544
|
}
|
|
241529
241545
|
__name(generateWrapperSource, "generateWrapperSource");
|
|
241530
241546
|
async function bundleUserScript(ctx) {
|
|
241531
|
-
const outputFile = (0,
|
|
241547
|
+
const outputFile = (0, import_node_path6.join)(ctx.buildDir, `${ctx.entryBasename}-bundle.cjs`);
|
|
241532
241548
|
ctx.options.verbose && console.log(` Bundling ${ctx.entryPath}...`);
|
|
241533
241549
|
try {
|
|
241534
241550
|
const externalPackages = ["node:*", ...ctx.options.external || []];
|
|
@@ -241574,7 +241590,7 @@ require.main = __origRequire.main;
|
|
|
241574
241590
|
build2.onLoad({ filter: /\.(ts|tsx|mts|cts)$/ }, async (args) => {
|
|
241575
241591
|
if (args.path.includes("node_modules"))
|
|
241576
241592
|
return null;
|
|
241577
|
-
const source = (0,
|
|
241593
|
+
const source = (0, import_node_fs5.readFileSync)(args.path, "utf-8");
|
|
241578
241594
|
return hasJsonSchemaMarkers(source) ? {
|
|
241579
241595
|
contents: transformJsonSchemas(args.path, source, ctx.projectDir),
|
|
241580
241596
|
loader: args.path.endsWith(".tsx") ? "tsx" : "ts"
|
|
@@ -241614,11 +241630,11 @@ __name(bundleUserScript, "bundleUserScript");
|
|
|
241614
241630
|
function copyThinkwellBundles(ctx) {
|
|
241615
241631
|
const bundles = ["thinkwell.cjs", "acp.cjs", "protocol.cjs"];
|
|
241616
241632
|
for (const bundle of bundles) {
|
|
241617
|
-
const src = (0,
|
|
241618
|
-
if (!(0,
|
|
241633
|
+
const src = (0, import_node_path6.join)(ctx.thinkwellDistPkg, bundle), dest = (0, import_node_path6.join)(ctx.buildDir, bundle);
|
|
241634
|
+
if (!(0, import_node_fs5.existsSync)(src))
|
|
241619
241635
|
throw new Error(`Thinkwell bundle not found: ${src}`);
|
|
241620
|
-
const content = (0,
|
|
241621
|
-
(0,
|
|
241636
|
+
const content = (0, import_node_fs5.readFileSync)(src);
|
|
241637
|
+
(0, import_node_fs5.writeFileSync)(dest, content), ctx.options.verbose && console.log(` Copied ${bundle}`);
|
|
241622
241638
|
}
|
|
241623
241639
|
}
|
|
241624
241640
|
__name(copyThinkwellBundles, "copyThinkwellBundles");
|
|
@@ -241628,13 +241644,13 @@ function isRunningFromCompiledBinary() {
|
|
|
241628
241644
|
__name(isRunningFromCompiledBinary, "isRunningFromCompiledBinary");
|
|
241629
241645
|
var PORTABLE_NODE_VERSION = "24.1.0";
|
|
241630
241646
|
function getCacheDir() {
|
|
241631
|
-
return process.env.THINKWELL_CACHE_DIR || (0,
|
|
241647
|
+
return process.env.THINKWELL_CACHE_DIR || (0, import_node_path6.join)((0, import_node_os.homedir)(), ".cache", "thinkwell");
|
|
241632
241648
|
}
|
|
241633
241649
|
__name(getCacheDir, "getCacheDir");
|
|
241634
241650
|
function getThinkwellVersion() {
|
|
241635
241651
|
try {
|
|
241636
|
-
const pkgPath = (0,
|
|
241637
|
-
return JSON.parse((0,
|
|
241652
|
+
const pkgPath = (0, import_node_path6.resolve)(__dirname2, "../../package.json");
|
|
241653
|
+
return JSON.parse((0, import_node_fs5.readFileSync)(pkgPath, "utf-8")).version || "unknown";
|
|
241638
241654
|
} catch {
|
|
241639
241655
|
return "unknown";
|
|
241640
241656
|
}
|
|
@@ -241650,8 +241666,8 @@ async function downloadFile(url, destPath, spinner) {
|
|
|
241650
241666
|
if (!response.ok)
|
|
241651
241667
|
throw new Error(`Failed to download ${url}: ${response.status} ${response.statusText}`);
|
|
241652
241668
|
const contentLength = response.headers.get("content-length"), totalBytes = contentLength ? parseInt(contentLength, 10) : 0;
|
|
241653
|
-
(0,
|
|
241654
|
-
const fileStream = (0,
|
|
241669
|
+
(0, import_node_fs5.mkdirSync)((0, import_node_path6.dirname)(destPath), { recursive: true });
|
|
241670
|
+
const fileStream = (0, import_node_fs5.createWriteStream)(destPath), reader = response.body?.getReader();
|
|
241655
241671
|
if (!reader)
|
|
241656
241672
|
throw new Error("No response body");
|
|
241657
241673
|
let downloadedBytes = 0;
|
|
@@ -241668,14 +241684,14 @@ async function downloadFile(url, destPath, spinner) {
|
|
|
241668
241684
|
} finally {
|
|
241669
241685
|
fileStream.end();
|
|
241670
241686
|
}
|
|
241671
|
-
await new Promise((
|
|
241672
|
-
fileStream.on("finish",
|
|
241687
|
+
await new Promise((resolve22, reject) => {
|
|
241688
|
+
fileStream.on("finish", resolve22), fileStream.on("error", reject);
|
|
241673
241689
|
});
|
|
241674
241690
|
}
|
|
241675
241691
|
__name(downloadFile, "downloadFile");
|
|
241676
241692
|
function hashFile(filePath) {
|
|
241677
|
-
const content = (0,
|
|
241678
|
-
return (0,
|
|
241693
|
+
const content = (0, import_node_fs5.readFileSync)(filePath);
|
|
241694
|
+
return (0, import_node_crypto2.createHash)("sha256").update(content).digest("hex");
|
|
241679
241695
|
}
|
|
241680
241696
|
__name(hashFile, "hashFile");
|
|
241681
241697
|
async function fetchExpectedChecksum(version, filename) {
|
|
@@ -241699,16 +241715,16 @@ function extractTarGz(archivePath, destDir) {
|
|
|
241699
241715
|
}
|
|
241700
241716
|
__name(extractTarGz, "extractTarGz");
|
|
241701
241717
|
async function ensurePortableNode(spinner) {
|
|
241702
|
-
const version = PORTABLE_NODE_VERSION, { platform, arch } = getNodePlatformArch(), cacheDir = (0,
|
|
241703
|
-
if ((0,
|
|
241718
|
+
const version = PORTABLE_NODE_VERSION, { platform, arch } = getNodePlatformArch(), cacheDir = (0, import_node_path6.join)(getCacheDir(), "node", `v${version}`), nodeBinary = process.platform === "win32" ? "node.exe" : "node", nodePath = (0, import_node_path6.join)(cacheDir, nodeBinary);
|
|
241719
|
+
if ((0, import_node_fs5.existsSync)(nodePath))
|
|
241704
241720
|
return nodePath;
|
|
241705
|
-
const filename = `node-v${version}-${platform}-${arch}.tar.gz`, url = `https://nodejs.org/dist/v${version}/${filename}`, archivePath = (0,
|
|
241721
|
+
const filename = `node-v${version}-${platform}-${arch}.tar.gz`, url = `https://nodejs.org/dist/v${version}/${filename}`, archivePath = (0, import_node_path6.join)(cacheDir, filename);
|
|
241706
241722
|
spinner?.start("Downloading Node.js runtime (first time only)...");
|
|
241707
241723
|
try {
|
|
241708
|
-
(0,
|
|
241724
|
+
(0, import_node_fs5.mkdirSync)(cacheDir, { recursive: true }), await downloadFile(url, archivePath, spinner), spinner?.start("Verifying download integrity...");
|
|
241709
241725
|
const expectedHash = await fetchExpectedChecksum(version, filename), actualHash = hashFile(archivePath);
|
|
241710
241726
|
if (actualHash !== expectedHash)
|
|
241711
|
-
throw (0,
|
|
241727
|
+
throw (0, import_node_fs5.rmSync)(archivePath, { force: true }), new Error(`Node.js download verification failed.
|
|
241712
241728
|
|
|
241713
241729
|
Expected: ${expectedHash}
|
|
241714
241730
|
Actual: ${actualHash}
|
|
@@ -241716,10 +241732,10 @@ async function ensurePortableNode(spinner) {
|
|
|
241716
241732
|
This may indicate a corrupted download or network interference.
|
|
241717
241733
|
Please retry or report this issue.`);
|
|
241718
241734
|
spinner?.start("Extracting Node.js..."), extractTarGz(archivePath, cacheDir);
|
|
241719
|
-
const extractedDir = (0,
|
|
241720
|
-
return (0,
|
|
241735
|
+
const extractedDir = (0, import_node_path6.join)(cacheDir, `node-v${version}-${platform}-${arch}`), extractedBin = (0, import_node_path6.join)(extractedDir, "bin", nodeBinary);
|
|
241736
|
+
return (0, import_node_fs5.copyFileSync)(extractedBin, nodePath), (0, import_node_fs5.chmodSync)(nodePath, 493), (0, import_node_fs5.rmSync)(extractedDir, { recursive: true, force: true }), (0, import_node_fs5.rmSync)(archivePath, { force: true }), spinner?.succeed(`Node.js v${version} cached to ${cacheDir}`), nodePath;
|
|
241721
241737
|
} catch (error) {
|
|
241722
|
-
(0,
|
|
241738
|
+
(0, import_node_fs5.rmSync)(cacheDir, { recursive: true, force: true });
|
|
241723
241739
|
const message = error instanceof Error ? error.message : String(error);
|
|
241724
241740
|
throw message.includes("ETIMEDOUT") || message.includes("ENOTFOUND") ? new Error(`Failed to download Node.js runtime.
|
|
241725
241741
|
|
|
@@ -241732,37 +241748,37 @@ If behind a proxy, set HTTPS_PROXY environment variable.`) : error;
|
|
|
241732
241748
|
}
|
|
241733
241749
|
__name(ensurePortableNode, "ensurePortableNode");
|
|
241734
241750
|
function ensurePkgCli() {
|
|
241735
|
-
const version = getThinkwellVersion(), pkgCliBaseDir = (0,
|
|
241736
|
-
if ((0,
|
|
241751
|
+
const version = getThinkwellVersion(), pkgCliBaseDir = (0, import_node_path6.join)(getCacheDir(), "pkg-cli"), cacheDir = (0, import_node_path6.join)(pkgCliBaseDir, version), pkgCliPath = (0, import_node_path6.join)(cacheDir, "pkg-cli.cjs"), preludeCheck = (0, import_node_path6.join)(cacheDir, "pkg-prelude", "bootstrap.js");
|
|
241752
|
+
if ((0, import_node_fs5.existsSync)(pkgCliPath) && (0, import_node_fs5.existsSync)(preludeCheck))
|
|
241737
241753
|
return pkgCliPath;
|
|
241738
|
-
const distPkgPath = (0,
|
|
241739
|
-
if (!(0,
|
|
241754
|
+
const distPkgPath = (0, import_node_path6.resolve)(__dirname2, "../../dist-pkg"), cliSrc = (0, import_node_path6.join)(distPkgPath, "pkg-cli.cjs");
|
|
241755
|
+
if (!(0, import_node_fs5.existsSync)(cliSrc))
|
|
241740
241756
|
throw new Error(`pkg CLI not found in compiled binary assets.
|
|
241741
241757
|
Expected at: ${cliSrc}
|
|
241742
241758
|
|
|
241743
241759
|
This may indicate a build issue. Please report this.`);
|
|
241744
|
-
(0,
|
|
241745
|
-
const pkgJsonSrc = (0,
|
|
241746
|
-
(0,
|
|
241747
|
-
const preludeDir = (0,
|
|
241748
|
-
(0,
|
|
241760
|
+
(0, import_node_fs5.mkdirSync)(cacheDir, { recursive: true }), (0, import_node_fs5.copyFileSync)(cliSrc, pkgCliPath);
|
|
241761
|
+
const pkgJsonSrc = (0, import_node_path6.join)(distPkgPath, "package.json");
|
|
241762
|
+
(0, import_node_fs5.existsSync)(pkgJsonSrc) && (0, import_node_fs5.copyFileSync)(pkgJsonSrc, (0, import_node_path6.join)(pkgCliBaseDir, "package.json"));
|
|
241763
|
+
const preludeDir = (0, import_node_path6.join)(cacheDir, "pkg-prelude");
|
|
241764
|
+
(0, import_node_fs5.mkdirSync)(preludeDir, { recursive: true });
|
|
241749
241765
|
for (const file of ["bootstrap.js", "diagnostic.js"]) {
|
|
241750
|
-
const src = (0,
|
|
241751
|
-
(0,
|
|
241766
|
+
const src = (0, import_node_path6.join)(distPkgPath, "pkg-prelude", file);
|
|
241767
|
+
(0, import_node_fs5.existsSync)(src) && (0, import_node_fs5.copyFileSync)(src, (0, import_node_path6.join)(preludeDir, file));
|
|
241752
241768
|
}
|
|
241753
|
-
const commonSrc = (0,
|
|
241754
|
-
(0,
|
|
241755
|
-
const dictionaryDir = (0,
|
|
241756
|
-
(0,
|
|
241769
|
+
const commonSrc = (0, import_node_path6.join)(distPkgPath, "pkg-common.cjs");
|
|
241770
|
+
(0, import_node_fs5.existsSync)(commonSrc) && (0, import_node_fs5.copyFileSync)(commonSrc, (0, import_node_path6.join)(cacheDir, "pkg-common.cjs"));
|
|
241771
|
+
const dictionaryDir = (0, import_node_path6.join)(pkgCliBaseDir, "dictionary");
|
|
241772
|
+
(0, import_node_fs5.mkdirSync)(dictionaryDir, { recursive: true });
|
|
241757
241773
|
for (const file of ["v8-7.8.js", "v8-8.4.js", "v8-12.4.js"]) {
|
|
241758
|
-
const src = (0,
|
|
241759
|
-
(0,
|
|
241774
|
+
const src = (0, import_node_path6.join)(distPkgPath, "pkg-dictionary", file);
|
|
241775
|
+
(0, import_node_fs5.existsSync)(src) && (0, import_node_fs5.copyFileSync)(src, (0, import_node_path6.join)(dictionaryDir, file));
|
|
241760
241776
|
}
|
|
241761
241777
|
return pkgCliPath;
|
|
241762
241778
|
}
|
|
241763
241779
|
__name(ensurePkgCli, "ensurePkgCli");
|
|
241764
241780
|
function spawnAsync(command, args, options = {}) {
|
|
241765
|
-
return new Promise((
|
|
241781
|
+
return new Promise((resolve22) => {
|
|
241766
241782
|
const proc = (0, import_node_child_process2.spawn)(command, args, {
|
|
241767
241783
|
cwd: options.cwd,
|
|
241768
241784
|
env: options.env || process.env,
|
|
@@ -241774,13 +241790,13 @@ function spawnAsync(command, args, options = {}) {
|
|
|
241774
241790
|
}), proc.stderr?.on("data", (data) => {
|
|
241775
241791
|
stderr += data.toString();
|
|
241776
241792
|
})), proc.on("close", (code) => {
|
|
241777
|
-
|
|
241793
|
+
resolve22({
|
|
241778
241794
|
exitCode: code ?? 1,
|
|
241779
241795
|
stdout,
|
|
241780
241796
|
stderr
|
|
241781
241797
|
});
|
|
241782
241798
|
}), proc.on("error", (error) => {
|
|
241783
|
-
|
|
241799
|
+
resolve22({
|
|
241784
241800
|
exitCode: 1,
|
|
241785
241801
|
stdout,
|
|
241786
241802
|
stderr: error.message
|
|
@@ -241790,8 +241806,8 @@ function spawnAsync(command, args, options = {}) {
|
|
|
241790
241806
|
}
|
|
241791
241807
|
__name(spawnAsync, "spawnAsync");
|
|
241792
241808
|
async function compileWithPkgSubprocess(ctx, wrapperPath, target2, outputPath, spinner) {
|
|
241793
|
-
const nodePath = await ensurePortableNode(spinner), pkgCliPath = ensurePkgCli(), pkgTarget = TARGET_MAP[target2], outputDir = (0,
|
|
241794
|
-
(0,
|
|
241809
|
+
const nodePath = await ensurePortableNode(spinner), pkgCliPath = ensurePkgCli(), pkgTarget = TARGET_MAP[target2], outputDir = (0, import_node_path6.dirname)(outputPath);
|
|
241810
|
+
(0, import_node_fs5.existsSync)(outputDir) || (0, import_node_fs5.mkdirSync)(outputDir, { recursive: true });
|
|
241795
241811
|
const args = [
|
|
241796
241812
|
pkgCliPath,
|
|
241797
241813
|
wrapperPath,
|
|
@@ -241812,7 +241828,7 @@ async function compileWithPkgSubprocess(ctx, wrapperPath, target2, outputPath, s
|
|
|
241812
241828
|
env: {
|
|
241813
241829
|
...process.env,
|
|
241814
241830
|
// Set pkg cache path for pkg-fetch downloads
|
|
241815
|
-
PKG_CACHE_PATH: (0,
|
|
241831
|
+
PKG_CACHE_PATH: (0, import_node_path6.join)(getCacheDir(), "pkg-cache")
|
|
241816
241832
|
},
|
|
241817
241833
|
verbose: ctx.options.verbose
|
|
241818
241834
|
});
|
|
@@ -241831,8 +241847,8 @@ async function compileWithPkg(ctx, wrapperPath, target2, outputPath, spinner) {
|
|
|
241831
241847
|
await compileWithPkgSubprocess(ctx, wrapperPath, target2, outputPath, spinner);
|
|
241832
241848
|
return;
|
|
241833
241849
|
}
|
|
241834
|
-
const { exec } = await import("@yao-pkg/pkg"), pkgTarget = TARGET_MAP[target2], outputDir = (0,
|
|
241835
|
-
(0,
|
|
241850
|
+
const { exec } = await import("@yao-pkg/pkg"), pkgTarget = TARGET_MAP[target2], outputDir = (0, import_node_path6.dirname)(outputPath);
|
|
241851
|
+
(0, import_node_fs5.existsSync)(outputDir) || (0, import_node_fs5.mkdirSync)(outputDir, { recursive: true });
|
|
241836
241852
|
const pkgConfig = [
|
|
241837
241853
|
wrapperPath,
|
|
241838
241854
|
"--targets",
|
|
@@ -241851,7 +241867,7 @@ async function compileWithPkg(ctx, wrapperPath, target2, outputPath, spinner) {
|
|
|
241851
241867
|
}
|
|
241852
241868
|
__name(compileWithPkg, "compileWithPkg");
|
|
241853
241869
|
function detectTopLevelAwait(filePath) {
|
|
241854
|
-
const lines = (0,
|
|
241870
|
+
const lines = (0, import_node_fs5.readFileSync)(filePath, "utf-8").split(`
|
|
241855
241871
|
`), awaits = [];
|
|
241856
241872
|
let depth = 0, inMultiLineComment = false;
|
|
241857
241873
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -241917,9 +241933,9 @@ function runDryRun(ctx) {
|
|
|
241917
241933
|
}
|
|
241918
241934
|
__name(runDryRun, "runDryRun");
|
|
241919
241935
|
async function runBundle(options) {
|
|
241920
|
-
const entryPath = (0,
|
|
241921
|
-
if (projectRoot && (0,
|
|
241922
|
-
const source = (0,
|
|
241936
|
+
const entryPath = (0, import_node_path6.isAbsolute)(options.entry) ? options.entry : (0, import_node_path6.resolve)(process.cwd(), options.entry), projectRoot = findProjectRoot((0, import_node_path6.dirname)(entryPath));
|
|
241937
|
+
if (projectRoot && (0, import_node_fs5.existsSync)(entryPath)) {
|
|
241938
|
+
const source = (0, import_node_fs5.readFileSync)(entryPath, "utf-8"), requireTypescript = hasJsonSchemaMarkers(source), depCheck = await checkDependencies(projectRoot);
|
|
241923
241939
|
hasMissingDeps(depCheck, { requireTypescript }) && (process.stderr.write(formatMissingDepsError(depCheck, { requireTypescript }) + `
|
|
241924
241940
|
`), process.exit(2));
|
|
241925
241941
|
}
|
|
@@ -241936,18 +241952,18 @@ async function runBundle(options) {
|
|
|
241936
241952
|
return;
|
|
241937
241953
|
}
|
|
241938
241954
|
log(ctx, `Building ${(0, import_node_util2.styleText)("bold", ctx.entryBasename)}...
|
|
241939
|
-
`), (0,
|
|
241955
|
+
`), (0, import_node_fs5.existsSync)(ctx.buildDir) && (0, import_node_fs5.rmSync)(ctx.buildDir, { recursive: true }), (0, import_node_fs5.mkdirSync)(ctx.buildDir, { recursive: true });
|
|
241940
241956
|
try {
|
|
241941
241957
|
let spinner = createSpinner(ctx, "Bundling with esbuild...");
|
|
241942
241958
|
spinner.start();
|
|
241943
241959
|
const userBundlePath = await bundleUserScript(ctx);
|
|
241944
241960
|
spinner.succeed("User script bundled"), spinner = createSpinner(ctx, "Preparing thinkwell packages..."), spinner.start(), copyThinkwellBundles(ctx), spinner.succeed("Thinkwell packages ready");
|
|
241945
|
-
const wrapperPath = (0,
|
|
241946
|
-
(0,
|
|
241961
|
+
const wrapperPath = (0, import_node_path6.join)(ctx.buildDir, "wrapper.cjs"), wrapperSource = generateWrapperSource(userBundlePath);
|
|
241962
|
+
(0, import_node_fs5.writeFileSync)(wrapperPath, wrapperSource), ctx.options.verbose && log(ctx, " Generated wrapper entry point");
|
|
241947
241963
|
const outputs = [];
|
|
241948
241964
|
for (const target2 of ctx.resolvedTargets) {
|
|
241949
241965
|
const outputPath = getOutputPath(ctx, target2);
|
|
241950
|
-
spinner = createSpinner(ctx, `Compiling for ${target2}...`), spinner.start(), await compileWithPkg(ctx, wrapperPath, target2, outputPath, spinner), outputs.push(outputPath), spinner.succeed(`Built ${(0,
|
|
241966
|
+
spinner = createSpinner(ctx, `Compiling for ${target2}...`), spinner.start(), await compileWithPkg(ctx, wrapperPath, target2, outputPath, spinner), outputs.push(outputPath), spinner.succeed(`Built ${(0, import_node_path6.basename)(outputPath)}`);
|
|
241951
241967
|
}
|
|
241952
241968
|
log(ctx, ""), log(ctx, (0, import_node_util2.styleText)("green", "Build complete!")), log(ctx, ""), log(ctx, (0, import_node_util2.styleText)("bold", "Output:"));
|
|
241953
241969
|
for (const output of outputs)
|
|
@@ -241958,7 +241974,7 @@ async function runBundle(options) {
|
|
|
241958
241974
|
Build artifacts preserved in: ${ctx.buildDir}`);
|
|
241959
241975
|
else
|
|
241960
241976
|
try {
|
|
241961
|
-
(0,
|
|
241977
|
+
(0, import_node_fs5.rmSync)(ctx.buildDir, { recursive: true });
|
|
241962
241978
|
} catch {
|
|
241963
241979
|
}
|
|
241964
241980
|
}
|
|
@@ -241980,11 +241996,11 @@ async function runWatchMode(options, projectDir) {
|
|
|
241980
241996
|
console.log((0, import_node_util2.styleText)("dim", `[${(/* @__PURE__ */ new Date()).toLocaleTimeString()}] Building...`));
|
|
241981
241997
|
try {
|
|
241982
241998
|
const freshCtx = initBundleContext(options);
|
|
241983
|
-
(0,
|
|
241999
|
+
(0, import_node_fs5.existsSync)(freshCtx.buildDir) && (0, import_node_fs5.rmSync)(freshCtx.buildDir, { recursive: true }), (0, import_node_fs5.mkdirSync)(freshCtx.buildDir, { recursive: true });
|
|
241984
242000
|
const userBundlePath = await bundleUserScript(freshCtx);
|
|
241985
242001
|
copyThinkwellBundles(freshCtx);
|
|
241986
|
-
const wrapperPath = (0,
|
|
241987
|
-
(0,
|
|
242002
|
+
const wrapperPath = (0, import_node_path6.join)(freshCtx.buildDir, "wrapper.cjs"), wrapperSource = generateWrapperSource(userBundlePath);
|
|
242003
|
+
(0, import_node_fs5.writeFileSync)(wrapperPath, wrapperSource);
|
|
241988
242004
|
const outputs = [];
|
|
241989
242005
|
for (const target2 of freshCtx.resolvedTargets) {
|
|
241990
242006
|
const outputPath = getOutputPath(freshCtx, target2);
|
|
@@ -241992,13 +242008,13 @@ async function runWatchMode(options, projectDir) {
|
|
|
241992
242008
|
}
|
|
241993
242009
|
if (!freshCtx.options.verbose)
|
|
241994
242010
|
try {
|
|
241995
|
-
(0,
|
|
242011
|
+
(0, import_node_fs5.rmSync)(freshCtx.buildDir, { recursive: true });
|
|
241996
242012
|
} catch {
|
|
241997
242013
|
}
|
|
241998
242014
|
const elapsed = Date.now() - startTime;
|
|
241999
242015
|
console.log((0, import_node_util2.styleText)("green", `\u2713 Built in ${elapsed}ms`));
|
|
242000
242016
|
for (const output of outputs)
|
|
242001
|
-
console.log((0, import_node_util2.styleText)("dim", ` ${(0,
|
|
242017
|
+
console.log((0, import_node_util2.styleText)("dim", ` ${(0, import_node_path6.basename)(output)}`));
|
|
242002
242018
|
console.log();
|
|
242003
242019
|
} catch (error) {
|
|
242004
242020
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -242015,7 +242031,7 @@ async function runWatchMode(options, projectDir) {
|
|
|
242015
242031
|
}
|
|
242016
242032
|
__name(scheduleRebuild, "scheduleRebuild");
|
|
242017
242033
|
await doBuild();
|
|
242018
|
-
const watchDir = ctx.entryDir, watcher = (0,
|
|
242034
|
+
const watchDir = ctx.entryDir, watcher = (0, import_node_fs5.watch)(watchDir, { recursive: true }, (_eventType, filename) => {
|
|
242019
242035
|
filename && (filename.includes("node_modules") || filename.startsWith(".") || filename.endsWith(".d.ts") || /\.(ts|tsx|js|jsx|mts|mjs|cts|cjs|json)$/.test(filename) && (ctx.options.verbose && console.log((0, import_node_util2.styleText)("dim", ` Changed: ${filename}`)), scheduleRebuild()));
|
|
242020
242036
|
}), cleanup = /* @__PURE__ */ __name(() => {
|
|
242021
242037
|
watcher.close(), debounceTimer && clearTimeout(debounceTimer), console.log(`
|