@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/cli.mjs
CHANGED
|
@@ -145,6 +145,10 @@ async function scanImportsFromPackage(sourceDir, packageName) {
|
|
|
145
145
|
`(?:import|export)\\s+(?:type\\s+)?\\{([^}]+)\\}\\s+from\\s+["']${escapedPkg}(/[\\w./-]+)?["']`,
|
|
146
146
|
"g"
|
|
147
147
|
);
|
|
148
|
+
const namespaceImportRegex = new RegExp(
|
|
149
|
+
`import\\s+\\*\\s+as\\s+\\w+\\s+from\\s+["']${escapedPkg}(/[\\w./-]+)?["']`,
|
|
150
|
+
"g"
|
|
151
|
+
);
|
|
148
152
|
const sourceFiles = await glob("**/*.{ts,tsx}", {
|
|
149
153
|
cwd: sourceDir,
|
|
150
154
|
ignore: ["node_modules/**", "dist/**"]
|
|
@@ -152,6 +156,11 @@ async function scanImportsFromPackage(sourceDir, packageName) {
|
|
|
152
156
|
for (const file of sourceFiles) {
|
|
153
157
|
try {
|
|
154
158
|
const content = await fs7.readFile(path8.join(sourceDir, file), "utf-8");
|
|
159
|
+
for (const match of content.matchAll(namespaceImportRegex)) {
|
|
160
|
+
const subpath = match[1] ? match[1].slice(1) : "";
|
|
161
|
+
if (!result[subpath]) result[subpath] = /* @__PURE__ */ new Set();
|
|
162
|
+
result[subpath].add("*");
|
|
163
|
+
}
|
|
155
164
|
for (const match of content.matchAll(importRegex)) {
|
|
156
165
|
const subpath = match[2] ? match[2].slice(1) : "";
|
|
157
166
|
if (!result[subpath]) result[subpath] = /* @__PURE__ */ new Set();
|
|
@@ -192,8 +201,10 @@ function createCoreGlobalPlugin(themePath) {
|
|
|
192
201
|
const moduleAccess = subpath ? `['${subpath}']` : "";
|
|
193
202
|
let namedExports = [];
|
|
194
203
|
const cacheKey = subpath || "__root__";
|
|
195
|
-
|
|
196
|
-
|
|
204
|
+
const cached = exportsBySubpath[cacheKey];
|
|
205
|
+
const needsAllExports = cached?.includes("*");
|
|
206
|
+
if (cached && cached.length > 0 && !needsAllExports) {
|
|
207
|
+
namedExports = [...new Set(cached)];
|
|
197
208
|
} else {
|
|
198
209
|
const distFileName = subpath ? `${subpath}.mjs` : "index.mjs";
|
|
199
210
|
let distPath = await resolveNodeModulesFile(
|
|
@@ -217,6 +228,11 @@ function createCoreGlobalPlugin(themePath) {
|
|
|
217
228
|
}).filter((n) => n.length > 0);
|
|
218
229
|
namedExports.push(...names);
|
|
219
230
|
}
|
|
231
|
+
if (cached && cached.length > 0) {
|
|
232
|
+
for (const n of cached) {
|
|
233
|
+
if (n !== "*") namedExports.push(n);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
220
236
|
namedExports = [...new Set(namedExports)];
|
|
221
237
|
} catch {
|
|
222
238
|
}
|