@arcote.tech/arc-cli 0.4.2 → 0.4.6
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/index.js +2127 -234
- package/package.json +1 -1
- package/src/builder/module-builder.ts +15 -1
- package/src/platform/server.ts +3 -0
- package/src/platform/shared.ts +20 -3
package/package.json
CHANGED
|
@@ -84,6 +84,9 @@ export const SHELL_EXTERNALS = [
|
|
|
84
84
|
"@arcote.tech/arc",
|
|
85
85
|
"@arcote.tech/arc-ds",
|
|
86
86
|
"@arcote.tech/arc-react",
|
|
87
|
+
"@arcote.tech/arc-auth",
|
|
88
|
+
"@arcote.tech/arc-utils",
|
|
89
|
+
"@arcote.tech/arc-workspace",
|
|
87
90
|
"@arcote.tech/platform",
|
|
88
91
|
];
|
|
89
92
|
|
|
@@ -217,6 +220,17 @@ export async function buildPackages(
|
|
|
217
220
|
// i18n extraction — collect translatable strings during bundling
|
|
218
221
|
const i18nCollector = new Map<string, Set<string>>();
|
|
219
222
|
|
|
223
|
+
// Plugin to force all @arcote.tech/* imports as external,
|
|
224
|
+
// even when resolved through symlinks (bun link)
|
|
225
|
+
const arcExternalPlugin: import("bun").BunPlugin = {
|
|
226
|
+
name: "arc-external",
|
|
227
|
+
setup(build) {
|
|
228
|
+
build.onResolve({ filter: /^@arcote\.tech\// }, (args) => {
|
|
229
|
+
return { path: args.path, external: true };
|
|
230
|
+
});
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
|
|
220
234
|
const result = await Bun.build({
|
|
221
235
|
entrypoints,
|
|
222
236
|
outdir: outDir,
|
|
@@ -224,7 +238,7 @@ export async function buildPackages(
|
|
|
224
238
|
format: "esm",
|
|
225
239
|
target: "browser",
|
|
226
240
|
external: SHELL_EXTERNALS,
|
|
227
|
-
plugins: [i18nExtractPlugin(i18nCollector, rootDir)],
|
|
241
|
+
plugins: [arcExternalPlugin, i18nExtractPlugin(i18nCollector, rootDir)],
|
|
228
242
|
naming: "[name].[ext]",
|
|
229
243
|
define: {
|
|
230
244
|
ONLY_SERVER: "false",
|
package/src/platform/server.ts
CHANGED
|
@@ -77,6 +77,9 @@ export function generateShellHtml(appName: string, manifest?: { title: string; f
|
|
|
77
77
|
"@arcote.tech/arc": "/shell/arc.js",
|
|
78
78
|
"@arcote.tech/arc-ds": "/shell/arc-ds.js",
|
|
79
79
|
"@arcote.tech/arc-react": "/shell/arc-react.js",
|
|
80
|
+
"@arcote.tech/arc-auth": "/shell/arc-auth.js",
|
|
81
|
+
"@arcote.tech/arc-utils": "/shell/arc-utils.js",
|
|
82
|
+
"@arcote.tech/arc-workspace": "/shell/arc-workspace.js",
|
|
80
83
|
"@arcote.tech/platform": "/shell/platform.js",
|
|
81
84
|
},
|
|
82
85
|
};
|
package/src/platform/shared.ts
CHANGED
|
@@ -206,6 +206,9 @@ export const { createPortal, flushSync } = ReactDOM;`,
|
|
|
206
206
|
["arc", "@arcote.tech/arc"],
|
|
207
207
|
["arc-ds", "@arcote.tech/arc-ds"],
|
|
208
208
|
["arc-react", "@arcote.tech/arc-react"],
|
|
209
|
+
["arc-auth", "@arcote.tech/arc-auth"],
|
|
210
|
+
["arc-utils", "@arcote.tech/arc-utils"],
|
|
211
|
+
["arc-workspace", "@arcote.tech/arc-workspace"],
|
|
209
212
|
["platform", "@arcote.tech/platform"],
|
|
210
213
|
];
|
|
211
214
|
|
|
@@ -230,6 +233,11 @@ export const { createPortal, flushSync } = ReactDOM;`,
|
|
|
230
233
|
"react/jsx-dev-runtime",
|
|
231
234
|
"react-dom/client",
|
|
232
235
|
],
|
|
236
|
+
define: {
|
|
237
|
+
ONLY_SERVER: "false",
|
|
238
|
+
ONLY_BROWSER: "true",
|
|
239
|
+
ONLY_CLIENT: "true",
|
|
240
|
+
},
|
|
233
241
|
});
|
|
234
242
|
if (!r2.success) {
|
|
235
243
|
for (const l of r2.logs) console.error(l);
|
|
@@ -259,6 +267,17 @@ export async function loadServerContext(
|
|
|
259
267
|
|
|
260
268
|
// Import all context packages — side effects from module().build()
|
|
261
269
|
// register context elements into the global registry via setContext().
|
|
270
|
+
// Resolve platform from the project's node_modules using an absolute path.
|
|
271
|
+
// When CLI is bun-linked, `import("@arcote.tech/platform")` would resolve to
|
|
272
|
+
// the CLI's own copy, creating a separate module instance from what context
|
|
273
|
+
// packages use. Using an absolute path ensures a single shared instance.
|
|
274
|
+
const platformDir = join(process.cwd(), "node_modules", "@arcote.tech", "platform");
|
|
275
|
+
const platformPkg = JSON.parse(readFileSync(join(platformDir, "package.json"), "utf-8"));
|
|
276
|
+
const platformEntry = join(platformDir, platformPkg.main ?? "src/index.ts");
|
|
277
|
+
|
|
278
|
+
// Pre-import platform so it's cached with this absolute path
|
|
279
|
+
await import(platformEntry);
|
|
280
|
+
|
|
262
281
|
for (const ctx of ctxPackages) {
|
|
263
282
|
const serverDist = join(ctx.path, "dist", "server", "main", "index.js");
|
|
264
283
|
if (!existsSync(serverDist)) {
|
|
@@ -273,8 +292,6 @@ export async function loadServerContext(
|
|
|
273
292
|
}
|
|
274
293
|
}
|
|
275
294
|
|
|
276
|
-
|
|
277
|
-
// in the arc-ui registry. Retrieve the merged context from there.
|
|
278
|
-
const { getContext } = await import("@arcote.tech/platform");
|
|
295
|
+
const { getContext } = await import(platformEntry);
|
|
279
296
|
return getContext() ?? null;
|
|
280
297
|
}
|