builder.io 1.1.28-1 → 1.1.29
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/angular/index.cjs +1 -46
- package/angular/index.mjs +1 -21
- package/cli/index.cjs +1518 -53221
- package/cli/index.cjs.map +4 -4
- package/core/index.cjs +828 -11649
- package/core/index.mjs +828 -11639
- package/figma/index.cjs +1 -35
- package/figma/index.mjs +1 -14
- package/node/index.cjs +3 -355
- package/node/index.mjs +3 -325
- package/package.json +2 -2
- package/remix/build.cjs +1 -132
- package/remix/index.mjs +1 -112
- package/server/index.cjs +223 -900
- package/server/index.mjs +225 -874
- package/vite/index.cjs +3 -142
- package/vite/index.mjs +3 -107
- package/webpack/index.cjs +27 -2875
- package/webpack/index.mjs +27 -2863
package/figma/index.cjs
CHANGED
|
@@ -1,35 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/dev-tools/figma/index.ts
|
|
21
|
-
var figma_exports = {};
|
|
22
|
-
__export(figma_exports, {
|
|
23
|
-
explicitFalse: () => explicitFalse,
|
|
24
|
-
figmaMapping: () => figmaMapping
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(figma_exports);
|
|
27
|
-
function figmaMapping(_config) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
function explicitFalse(value) {
|
|
31
|
-
if (value === false) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
return value;
|
|
35
|
-
}
|
|
1
|
+
"use strict";var t=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var s=(e,n)=>{for(var a in n)t(e,a,{get:n[a],enumerable:!0})},m=(e,n,a,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of o(n))!g.call(e,i)&&i!==a&&t(e,i,{get:()=>n[i],enumerable:!(r=p(n,i))||r.enumerable});return e};var d=e=>m(t({},"__esModule",{value:!0}),e);var y={};s(y,{explicitFalse:()=>c,figmaMapping:()=>F});module.exports=d(y);function F(e){}function c(e){return e===!1?!1:e}
|
package/figma/index.mjs
CHANGED
|
@@ -1,14 +1 @@
|
|
|
1
|
-
|
|
2
|
-
function figmaMapping(_config) {
|
|
3
|
-
return;
|
|
4
|
-
}
|
|
5
|
-
function explicitFalse(value) {
|
|
6
|
-
if (value === false) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
return value;
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
explicitFalse,
|
|
13
|
-
figmaMapping
|
|
14
|
-
};
|
|
1
|
+
function n(e){}function i(e){return e===!1?!1:e}export{i as explicitFalse,n as figmaMapping};
|
package/node/index.cjs
CHANGED
|
@@ -1,355 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// packages/dev-tools/node/index.ts
|
|
31
|
-
var node_exports = {};
|
|
32
|
-
__export(node_exports, {
|
|
33
|
-
createDevToolsNodeSys: () => createDevToolsNodeSys
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(node_exports);
|
|
36
|
-
|
|
37
|
-
// packages/dev-tools/node/node-sys.ts
|
|
38
|
-
var import_promises = require("node:fs/promises");
|
|
39
|
-
var import_node_crypto = require("node:crypto");
|
|
40
|
-
var import_node_fs = require("node:fs");
|
|
41
|
-
var import_node_os = require("node:os");
|
|
42
|
-
var import_node_path = __toESM(require("node:path"), 1);
|
|
43
|
-
var import_prettier = __toESM(require("prettier"), 1);
|
|
44
|
-
var import_typescript = __toESM(require("typescript"), 1);
|
|
45
|
-
var import_launch_editor = __toESM(require("launch-editor"), 1);
|
|
46
|
-
|
|
47
|
-
// packages/dev-tools/common/fs.ts
|
|
48
|
-
async function findPackageJson(sys, dir) {
|
|
49
|
-
const fsRoot = sys.resolve("/");
|
|
50
|
-
for (let i = 0; i < 20; i++) {
|
|
51
|
-
const pkgJsonPath = sys.join(dir, "package.json");
|
|
52
|
-
const content = await sys.readFile(pkgJsonPath);
|
|
53
|
-
if (content) {
|
|
54
|
-
const pkgJson = JSON.parse(content);
|
|
55
|
-
return pkgJson;
|
|
56
|
-
}
|
|
57
|
-
if (dir === fsRoot) {
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
dir = sys.dirname(dir);
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// packages/dev-tools/core/detect-frameworks.ts
|
|
66
|
-
async function detectFrameworks(sys) {
|
|
67
|
-
const frameworks = [];
|
|
68
|
-
const pkgJson = await findPackageJson(sys, sys.getRootDir());
|
|
69
|
-
if (pkgJson) {
|
|
70
|
-
const depFrameworks = detectFrameworksFromPackageJson(pkgJson);
|
|
71
|
-
frameworks.push(...depFrameworks);
|
|
72
|
-
}
|
|
73
|
-
return frameworks;
|
|
74
|
-
}
|
|
75
|
-
function detectFrameworksFromPackageJson(pkgJson) {
|
|
76
|
-
const frameworks = [];
|
|
77
|
-
if (pkgJson && typeof pkgJson === "object") {
|
|
78
|
-
const depNames = new Set(
|
|
79
|
-
Object.keys({
|
|
80
|
-
...pkgJson.dependencies,
|
|
81
|
-
...pkgJson.devDependencies
|
|
82
|
-
})
|
|
83
|
-
);
|
|
84
|
-
for (const depName of FRAMEWORKS) {
|
|
85
|
-
if (depNames.has(depName)) {
|
|
86
|
-
if (!frameworks.some((f) => f.name === depName)) {
|
|
87
|
-
frameworks.push({ name: depName });
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return frameworks;
|
|
93
|
-
}
|
|
94
|
-
var FRAMEWORKS = [
|
|
95
|
-
// toolkit frameworks
|
|
96
|
-
"@shopify/remix-oxygen",
|
|
97
|
-
"@shopify/hydrogen",
|
|
98
|
-
// meta frameworks
|
|
99
|
-
"@builder.io/qwik-city",
|
|
100
|
-
"@remix-run/react",
|
|
101
|
-
"@sveltejs/kit",
|
|
102
|
-
"astro",
|
|
103
|
-
"gatsby",
|
|
104
|
-
"next",
|
|
105
|
-
"nuxt",
|
|
106
|
-
// frameworks
|
|
107
|
-
"@builder.io/qwik",
|
|
108
|
-
"@angular/core",
|
|
109
|
-
"react",
|
|
110
|
-
"solid-js",
|
|
111
|
-
"svelte",
|
|
112
|
-
"vue"
|
|
113
|
-
];
|
|
114
|
-
|
|
115
|
-
// packages/dev-tools/node/node-sys.ts
|
|
116
|
-
var import_node_child_process = require("node:child_process");
|
|
117
|
-
async function createDevToolsNodeSys(opts) {
|
|
118
|
-
const onChangeCallbacks = /* @__PURE__ */ new Set();
|
|
119
|
-
const debug = (...args) => {
|
|
120
|
-
if (process.env.DEBUG) {
|
|
121
|
-
const d = /* @__PURE__ */ new Date();
|
|
122
|
-
const ts2 = `${String(d.getMinutes()).padStart(2, "0")}:${String(
|
|
123
|
-
d.getSeconds()
|
|
124
|
-
).padStart(2, "0")}.${String(d.getMilliseconds()).padStart(3, "0")}`;
|
|
125
|
-
console.debug(ts2, `[builder-dev-tools]`, ...args);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
const hash = async (str) => {
|
|
129
|
-
const hash2 = (0, import_node_crypto.createHash)("md5");
|
|
130
|
-
hash2.update(str);
|
|
131
|
-
return hash2.digest("hex");
|
|
132
|
-
};
|
|
133
|
-
const nodeFs = {
|
|
134
|
-
...import_node_path.default,
|
|
135
|
-
getRootDir: () => import_node_path.default.normalize(opts.getRootDir()),
|
|
136
|
-
cwd: () => process.cwd(),
|
|
137
|
-
exists: async (p) => {
|
|
138
|
-
validatePath(opts, p);
|
|
139
|
-
try {
|
|
140
|
-
await (0, import_promises.access)(p);
|
|
141
|
-
return true;
|
|
142
|
-
} catch (e) {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
existsSync: (p) => {
|
|
147
|
-
return (0, import_node_fs.existsSync)(p);
|
|
148
|
-
},
|
|
149
|
-
readdir: async (p, absolutePaths) => {
|
|
150
|
-
validatePath(opts, p);
|
|
151
|
-
const items = await (0, import_promises.readdir)(p);
|
|
152
|
-
if (absolutePaths) {
|
|
153
|
-
return items.map((i) => import_node_path.default.join(p, i));
|
|
154
|
-
}
|
|
155
|
-
return items;
|
|
156
|
-
},
|
|
157
|
-
readdirSync: (p) => {
|
|
158
|
-
validatePath(opts, p);
|
|
159
|
-
return (0, import_node_fs.readdirSync)(p);
|
|
160
|
-
},
|
|
161
|
-
readFile: async (p) => {
|
|
162
|
-
validatePath(opts, p);
|
|
163
|
-
try {
|
|
164
|
-
const content = await (0, import_promises.readFile)(p, "utf-8");
|
|
165
|
-
return content;
|
|
166
|
-
} catch (e) {
|
|
167
|
-
if (e.code === "ENOENT") {
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
debug(e, p);
|
|
171
|
-
throw e;
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
readFileSync(p) {
|
|
175
|
-
validatePath(opts, p);
|
|
176
|
-
try {
|
|
177
|
-
return (0, import_node_fs.readFileSync)(p, "utf-8");
|
|
178
|
-
} catch (e) {
|
|
179
|
-
if (e.code === "ENOENT") {
|
|
180
|
-
return null;
|
|
181
|
-
}
|
|
182
|
-
debug(e, p);
|
|
183
|
-
throw e;
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
stat: async (p) => {
|
|
187
|
-
validatePath(opts, p);
|
|
188
|
-
const s = await (0, import_promises.stat)(p);
|
|
189
|
-
return s;
|
|
190
|
-
},
|
|
191
|
-
statSync: (p) => {
|
|
192
|
-
validatePath(opts, p);
|
|
193
|
-
return (0, import_node_fs.statSync)(p);
|
|
194
|
-
},
|
|
195
|
-
writeFile: async (p, contents) => {
|
|
196
|
-
validatePath(opts, p);
|
|
197
|
-
p = import_node_path.default.normalize(p);
|
|
198
|
-
const fileInfo = {
|
|
199
|
-
path: p,
|
|
200
|
-
basename: import_node_path.default.basename(p),
|
|
201
|
-
dirname: import_node_path.default.dirname(p),
|
|
202
|
-
extname: import_node_path.default.extname(p)
|
|
203
|
-
};
|
|
204
|
-
await (0, import_promises.mkdir)(import_node_path.default.dirname(p), { recursive: true });
|
|
205
|
-
await (0, import_promises.writeFile)(p, contents);
|
|
206
|
-
for (const onChangeCallback of onChangeCallbacks) {
|
|
207
|
-
await onChangeCallback(fileInfo);
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
hash,
|
|
211
|
-
getDeviceId: () => hash(`${(0, import_node_os.hostname)()}:${(0, import_node_os.homedir)()}`),
|
|
212
|
-
formatCode: async (filePath, code) => {
|
|
213
|
-
let userOpts = null;
|
|
214
|
-
try {
|
|
215
|
-
userOpts = await import_prettier.default.resolveConfig(filePath);
|
|
216
|
-
} catch (e) {
|
|
217
|
-
}
|
|
218
|
-
try {
|
|
219
|
-
return import_prettier.default.format(code, {
|
|
220
|
-
...userOpts,
|
|
221
|
-
filepath: filePath
|
|
222
|
-
});
|
|
223
|
-
} catch (e) {
|
|
224
|
-
}
|
|
225
|
-
return code;
|
|
226
|
-
},
|
|
227
|
-
on: (eventName, callback) => {
|
|
228
|
-
if (eventName === "change") {
|
|
229
|
-
onChangeCallbacks.add(callback);
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
off: (eventName, callback) => {
|
|
233
|
-
if (eventName === "change") {
|
|
234
|
-
onChangeCallbacks.delete(callback);
|
|
235
|
-
}
|
|
236
|
-
},
|
|
237
|
-
debug,
|
|
238
|
-
launchEditor: async (file) => {
|
|
239
|
-
try {
|
|
240
|
-
let filePath = file.filePath;
|
|
241
|
-
if (typeof file.line === "number") {
|
|
242
|
-
filePath += `:${file.line}`;
|
|
243
|
-
if (typeof file.column === "number") {
|
|
244
|
-
filePath += `:${file.column}`;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
(0, import_launch_editor.default)(filePath, "code", (p, e) => {
|
|
248
|
-
console.error(`Failed to launch editor for ${p}`);
|
|
249
|
-
if (e) {
|
|
250
|
-
console.error(e);
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
} catch (e) {
|
|
254
|
-
console.error(`Failed to launch editor for ${String(e.message || e)}`);
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
platform: () => {
|
|
258
|
-
return { runtime: "node", os: process.platform };
|
|
259
|
-
},
|
|
260
|
-
getRepoInfo: async () => {
|
|
261
|
-
const rootDir = import_node_path.default.normalize(opts.getRootDir());
|
|
262
|
-
return {
|
|
263
|
-
remoteUrl: getGitRemoteURL(rootDir),
|
|
264
|
-
defaultBranch: getGitRepoDefaultBranchName(rootDir),
|
|
265
|
-
commit: getGitCommit(rootDir),
|
|
266
|
-
currentBranch: getCurrentBranchName(rootDir)
|
|
267
|
-
};
|
|
268
|
-
},
|
|
269
|
-
getFrameworks: () => [],
|
|
270
|
-
ts: import_typescript.default,
|
|
271
|
-
version: true ? "1.1.28-dev" : "0.0.0",
|
|
272
|
-
sdkVersion: null,
|
|
273
|
-
ignoreMissingConfig: opts.ignoreMissingConfig,
|
|
274
|
-
kind: null
|
|
275
|
-
};
|
|
276
|
-
const frameworks = await detectFrameworks(nodeFs);
|
|
277
|
-
nodeFs.getFrameworks = () => frameworks;
|
|
278
|
-
return nodeFs;
|
|
279
|
-
}
|
|
280
|
-
function validatePath(opts, userPath) {
|
|
281
|
-
if (opts.skipValidate) {
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
if (!userPath) {
|
|
285
|
-
throw new Error(`Invalid path: ${userPath} (7340)`);
|
|
286
|
-
}
|
|
287
|
-
userPath = import_node_path.default.normalize(import_node_path.default.resolve(userPath));
|
|
288
|
-
const rootDir = opts.getRootDir();
|
|
289
|
-
if (!userPath.startsWith(rootDir) && !userPath.includes("node_modules")) {
|
|
290
|
-
throw new Error(`Invalid path: ${userPath} (7341)`);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
function getGitRemoteURL(repoPath) {
|
|
294
|
-
try {
|
|
295
|
-
const spawn = (0, import_node_child_process.spawnSync)("git", ["config", "--get", "remote.origin.url"], {
|
|
296
|
-
cwd: repoPath
|
|
297
|
-
});
|
|
298
|
-
const output = spawn.stdout;
|
|
299
|
-
return (output || "").toString().trim();
|
|
300
|
-
} catch (error) {
|
|
301
|
-
console.error("Error getting git remote URL:", error);
|
|
302
|
-
return "";
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
function getGitRepoDefaultBranchName(repoPath) {
|
|
306
|
-
const DEFAULT_BRANCH_NAME = "master";
|
|
307
|
-
try {
|
|
308
|
-
const gitBranchResult = (0, import_node_child_process.spawnSync)("git", ["branch", "-r"], {
|
|
309
|
-
cwd: repoPath
|
|
310
|
-
});
|
|
311
|
-
if (!gitBranchResult.stdout) {
|
|
312
|
-
return DEFAULT_BRANCH_NAME;
|
|
313
|
-
}
|
|
314
|
-
const branches = gitBranchResult.stdout.toString().trim().split("\n").map((s) => s.trim());
|
|
315
|
-
if (branches.includes("origin/main")) {
|
|
316
|
-
return "main";
|
|
317
|
-
} else {
|
|
318
|
-
return DEFAULT_BRANCH_NAME;
|
|
319
|
-
}
|
|
320
|
-
} catch (error) {
|
|
321
|
-
console.error(
|
|
322
|
-
"Error getting git default branch name:",
|
|
323
|
-
error.toString().split("\n")[0]
|
|
324
|
-
);
|
|
325
|
-
return DEFAULT_BRANCH_NAME;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
function getGitCommit(repoPath) {
|
|
329
|
-
try {
|
|
330
|
-
const spawn = (0, import_node_child_process.spawnSync)("git", ["rev-parse", "HEAD"], {
|
|
331
|
-
cwd: repoPath
|
|
332
|
-
});
|
|
333
|
-
const output = spawn.stdout;
|
|
334
|
-
return (output || "").toString().trim();
|
|
335
|
-
} catch (error) {
|
|
336
|
-
console.error("Error getting git commit:", error);
|
|
337
|
-
return "";
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
function getCurrentBranchName(repoPath) {
|
|
341
|
-
try {
|
|
342
|
-
const spawn = (0, import_node_child_process.spawnSync)("git", ["branch", "--show-current"], {
|
|
343
|
-
cwd: repoPath
|
|
344
|
-
});
|
|
345
|
-
const output = spawn.stdout;
|
|
346
|
-
return (output || "").toString().trim();
|
|
347
|
-
} catch (error) {
|
|
348
|
-
console.error("Error getting current branch name:", error);
|
|
349
|
-
return "";
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
353
|
-
0 && (module.exports = {
|
|
354
|
-
createDevToolsNodeSys
|
|
355
|
-
});
|
|
1
|
+
"use strict";var C=Object.create;var p=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var T=(e,r)=>{for(var o in r)p(e,o,{get:r[o],enumerable:!0})},S=(e,r,o,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of N(r))!R.call(e,a)&&a!==o&&p(e,a,{get:()=>r[a],enumerable:!(i=E(r,a))||i.enumerable});return e};var y=(e,r,o)=>(o=e!=null?C(x(e)):{},S(r||!e||!e.__esModule?p(o,"default",{value:e,enumerable:!0}):o,e)),j=e=>S(p({},"__esModule",{value:!0}),e);var V={};T(V,{createDevToolsNodeSys:()=>O});module.exports=j(V);var c=require("node:fs/promises"),v=require("node:crypto"),g=require("node:fs"),h=require("node:os"),s=y(require("node:path"),1),w=y(require("prettier"),1),b=y(require("typescript"),1),F=y(require("launch-editor"),1);async function k(e,r){let o=e.resolve("/");for(let i=0;i<20;i++){let a=e.join(r,"package.json"),m=await e.readFile(a);if(m)return JSON.parse(m);if(r===o)break;r=e.dirname(r)}return null}async function D(e){let r=[],o=await k(e,e.getRootDir());if(o){let i=P(o);r.push(...i)}return r}function P(e){let r=[];if(e&&typeof e=="object"){let o=new Set(Object.keys({...e.dependencies,...e.devDependencies}));for(let i of _)o.has(i)&&(r.some(a=>a.name===i)||r.push({name:i}))}return r}var _=["@shopify/remix-oxygen","@shopify/hydrogen","@builder.io/qwik-city","@remix-run/react","@sveltejs/kit","astro","gatsby","next","nuxt","@builder.io/qwik","@angular/core","react","solid-js","svelte","vue"];var d=require("node:child_process");async function O(e){let r=new Set,o=(...t)=>{if(process.env.DEBUG){let n=new Date,l=`${String(n.getMinutes()).padStart(2,"0")}:${String(n.getSeconds()).padStart(2,"0")}.${String(n.getMilliseconds()).padStart(3,"0")}`;console.debug(l,"[builder-dev-tools]",...t)}},i=async t=>{let n=(0,v.createHash)("md5");return n.update(t),n.digest("hex")},a={...s.default,getRootDir:()=>s.default.normalize(e.getRootDir()),cwd:()=>process.cwd(),exists:async t=>{f(e,t);try{return await(0,c.access)(t),!0}catch{return!1}},existsSync:t=>(0,g.existsSync)(t),readdir:async(t,n)=>{f(e,t);let l=await(0,c.readdir)(t);return n?l.map(u=>s.default.join(t,u)):l},readdirSync:t=>(f(e,t),(0,g.readdirSync)(t)),readFile:async t=>{f(e,t);try{return await(0,c.readFile)(t,"utf-8")}catch(n){if(n.code==="ENOENT")return null;throw o(n,t),n}},readFileSync(t){f(e,t);try{return(0,g.readFileSync)(t,"utf-8")}catch(n){if(n.code==="ENOENT")return null;throw o(n,t),n}},stat:async t=>(f(e,t),await(0,c.stat)(t)),statSync:t=>(f(e,t),(0,g.statSync)(t)),writeFile:async(t,n)=>{f(e,t),t=s.default.normalize(t);let l={path:t,basename:s.default.basename(t),dirname:s.default.dirname(t),extname:s.default.extname(t)};await(0,c.mkdir)(s.default.dirname(t),{recursive:!0}),await(0,c.writeFile)(t,n);for(let u of r)await u(l)},hash:i,getDeviceId:()=>i(`${(0,h.hostname)()}:${(0,h.homedir)()}`),formatCode:async(t,n)=>{let l=null;try{l=await w.default.resolveConfig(t)}catch{}try{return w.default.format(n,{...l,filepath:t})}catch{}return n},on:(t,n)=>{t==="change"&&r.add(n)},off:(t,n)=>{t==="change"&&r.delete(n)},debug:o,launchEditor:async t=>{try{let n=t.filePath;typeof t.line=="number"&&(n+=`:${t.line}`,typeof t.column=="number"&&(n+=`:${t.column}`)),(0,F.default)(n,"code",(l,u)=>{console.error(`Failed to launch editor for ${l}`),u&&console.error(u)})}catch(n){console.error(`Failed to launch editor for ${String(n.message||n)}`)}},platform:()=>({runtime:"node",os:process.platform}),getRepoInfo:async()=>{let t=s.default.normalize(e.getRootDir());return{remoteUrl:J(t),defaultBranch:$(t),commit:I(t),currentBranch:M(t)}},getFrameworks:()=>[],ts:b.default,version:"1.1.29",sdkVersion:null,ignoreMissingConfig:e.ignoreMissingConfig,kind:null},m=await D(a);return a.getFrameworks=()=>m,a}function f(e,r){if(e.skipValidate)return;if(!r)throw new Error(`Invalid path: ${r} (7340)`);r=s.default.normalize(s.default.resolve(r));let o=e.getRootDir();if(!r.startsWith(o)&&!r.includes("node_modules"))throw new Error(`Invalid path: ${r} (7341)`)}function J(e){try{return((0,d.spawnSync)("git",["config","--get","remote.origin.url"],{cwd:e}).stdout||"").toString().trim()}catch(r){return console.error("Error getting git remote URL:",r),""}}function $(e){let r="master";try{let o=(0,d.spawnSync)("git",["branch","-r"],{cwd:e});return o.stdout&&o.stdout.toString().trim().split(`
|
|
2
|
+
`).map(a=>a.trim()).includes("origin/main")?"main":r}catch(o){return console.error("Error getting git default branch name:",o.toString().split(`
|
|
3
|
+
`)[0]),r}}function I(e){try{return((0,d.spawnSync)("git",["rev-parse","HEAD"],{cwd:e}).stdout||"").toString().trim()}catch(r){return console.error("Error getting git commit:",r),""}}function M(e){try{return((0,d.spawnSync)("git",["branch","--show-current"],{cwd:e}).stdout||"").toString().trim()}catch(r){return console.error("Error getting current branch name:",r),""}}0&&(module.exports={createDevToolsNodeSys});
|