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