@onexapis/cli 1.1.32 → 1.1.34
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/cli.js +18 -2
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +18 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -2
- package/dist/index.mjs.map +1 -1
- package/dist/preview/preview-app.tsx +8 -2
- package/package.json +2 -2
- package/templates/default/CLAUDE.md +38 -43
package/dist/index.js
CHANGED
|
@@ -180,6 +180,10 @@ async function scanImportsFromPackage(sourceDir, packageName) {
|
|
|
180
180
|
`(?:import|export)\\s+(?:type\\s+)?\\{([^}]+)\\}\\s+from\\s+["']${escapedPkg}(/[\\w./-]+)?["']`,
|
|
181
181
|
"g"
|
|
182
182
|
);
|
|
183
|
+
const namespaceImportRegex = new RegExp(
|
|
184
|
+
`import\\s+\\*\\s+as\\s+\\w+\\s+from\\s+["']${escapedPkg}(/[\\w./-]+)?["']`,
|
|
185
|
+
"g"
|
|
186
|
+
);
|
|
183
187
|
const sourceFiles = await glob.glob("**/*.{ts,tsx}", {
|
|
184
188
|
cwd: sourceDir,
|
|
185
189
|
ignore: ["node_modules/**", "dist/**"]
|
|
@@ -187,6 +191,11 @@ async function scanImportsFromPackage(sourceDir, packageName) {
|
|
|
187
191
|
for (const file of sourceFiles) {
|
|
188
192
|
try {
|
|
189
193
|
const content = await fs6__default.default.readFile(path7__default.default.join(sourceDir, file), "utf-8");
|
|
194
|
+
for (const match of content.matchAll(namespaceImportRegex)) {
|
|
195
|
+
const subpath = match[1] ? match[1].slice(1) : "";
|
|
196
|
+
if (!result[subpath]) result[subpath] = /* @__PURE__ */ new Set();
|
|
197
|
+
result[subpath].add("*");
|
|
198
|
+
}
|
|
190
199
|
for (const match of content.matchAll(importRegex)) {
|
|
191
200
|
const subpath = match[2] ? match[2].slice(1) : "";
|
|
192
201
|
if (!result[subpath]) result[subpath] = /* @__PURE__ */ new Set();
|
|
@@ -227,8 +236,10 @@ function createCoreGlobalPlugin(themePath) {
|
|
|
227
236
|
const moduleAccess = subpath ? `['${subpath}']` : "";
|
|
228
237
|
let namedExports = [];
|
|
229
238
|
const cacheKey = subpath || "__root__";
|
|
230
|
-
|
|
231
|
-
|
|
239
|
+
const cached = exportsBySubpath[cacheKey];
|
|
240
|
+
const needsAllExports = cached?.includes("*");
|
|
241
|
+
if (cached && cached.length > 0 && !needsAllExports) {
|
|
242
|
+
namedExports = [...new Set(cached)];
|
|
232
243
|
} else {
|
|
233
244
|
const distFileName = subpath ? `${subpath}.mjs` : "index.mjs";
|
|
234
245
|
let distPath = await resolveNodeModulesFile(
|
|
@@ -252,6 +263,11 @@ function createCoreGlobalPlugin(themePath) {
|
|
|
252
263
|
}).filter((n) => n.length > 0);
|
|
253
264
|
namedExports.push(...names);
|
|
254
265
|
}
|
|
266
|
+
if (cached && cached.length > 0) {
|
|
267
|
+
for (const n of cached) {
|
|
268
|
+
if (n !== "*") namedExports.push(n);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
255
271
|
namedExports = [...new Set(namedExports)];
|
|
256
272
|
} catch {
|
|
257
273
|
}
|