@byline/cli 2.4.0 → 2.4.1

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.
@@ -44,14 +44,21 @@ const bylineSsrNoExternal = [/^@byline\//]
44
44
  // - sharp + @byline/storage-local — image processing (libvips)
45
45
  // - @byline/storage-s3 — bundles the AWS SDK; keep external for Node resolution
46
46
  // - @byline/db-postgres — depends on `pg` native bindings
47
- // - @byline/admin — re-exports server-only code that imports the above
48
47
  // - pino — CJS entrypoints don't execute under Vite's module runner
48
+ //
49
+ // `@byline/admin` is intentionally NOT externalised: it now hosts
50
+ // React admin UI subpaths (`/admin-users/components/*`, `/services`,
51
+ // `/auth/components/sign-in-form`, etc.) whose compiled JS does
52
+ // `import './foo_module.css'`. Node's ESM loader can't handle `.css`,
53
+ // so admin must flow through Vite's SSR pipeline where the CSS plugin
54
+ // resolves the side-effect imports. Server-only admin subpaths reach
55
+ // db-postgres / storage adapters through composition at runtime, not
56
+ // through `@byline/admin`'s own import graph, so this is safe.
49
57
  const ssrExternal = [
50
58
  'sharp',
51
59
  'pino',
52
60
  '@byline/storage-local',
53
61
  '@byline/storage-s3',
54
- '@byline/admin',
55
62
  '@byline/db-postgres',
56
63
  ]
57
64
 
@@ -143,14 +150,13 @@ const config = defineConfig({
143
150
  devtools(),
144
151
  nitro({
145
152
  preset: 'node',
146
- // @byline/ui ships compiled JS that does `import './foo_module.css'`.
147
- // @byline/host-tanstack-start re-exports route factories from
148
- // @byline/ui at runtime in the SSR graph. Nitro externalizes
149
- // node_modules by default, which sends those imports to Node's
150
- // ESM loader which can't handle .css. Inlining both packages
151
- // through Nitro's pipeline lets Vite's CSS plugin process the
152
- // side-effect imports.
153
- noExternals: ['@byline/ui', '@byline/host-tanstack-start'],
153
+ // @byline/ui, @byline/admin, and @byline/host-tanstack-start all
154
+ // ship compiled JS that does `import './foo_module.css'`. Nitro
155
+ // externalizes node_modules by default, which would send those
156
+ // imports to Node's ESM loader which can't handle .css.
157
+ // Inlining these three packages through Nitro's pipeline lets
158
+ // Vite's CSS plugin process the side-effect imports.
159
+ noExternals: ['@byline/ui', '@byline/admin', '@byline/host-tanstack-start'],
154
160
  // When Nitro inlines `@byline/host-tanstack-start` it pulls in
155
161
  // `@byline/core`, which depends on pino. Pino's CJS entry can't be
156
162
  // bundled, so we externalize it (and other native deps) here at
@@ -179,7 +185,7 @@ const config = defineConfig({
179
185
  'react-dom',
180
186
  'pino',
181
187
  'sharp',
182
- /^@byline\/(admin|db-postgres|storage-local|storage-s3)/,
188
+ /^@byline\/(db-postgres|storage-local|storage-s3)/,
183
189
  ],
184
190
  },
185
191
  }),
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@byline/cli",
3
3
  "private": false,
4
4
  "license": "MPL-2.0",
5
- "version": "2.4.0",
5
+ "version": "2.4.1",
6
6
  "engines": {
7
7
  "node": ">=20.9.0"
8
8
  },
@@ -1,3 +0,0 @@
1
- import type { SubEdit } from './shared.js';
2
- export declare const wireRootTsx: SubEdit;
3
- //# sourceMappingURL=root-tsx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"root-tsx.d.ts","sourceRoot":"","sources":["../../../src/phases/wire/root-tsx.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAiB,MAAM,aAAa,CAAA;AASzD,eAAO,MAAM,WAAW,EAAE,OASzB,CAAA"}
@@ -1,57 +0,0 @@
1
- import { existsSync, readFileSync } from 'node:fs';
2
- import { Project } from 'ts-morph';
3
- const REL = 'src/routes/__root.tsx';
4
- const IMPORT_SPECIFIER = '../../byline/admin.config';
5
- const SNIPPET = `// Initialize Byline admin config — must be imported here so it runs in both
6
- // the SSR rendering and client module graphs (see byline/admin.config.ts).
7
- import '${IMPORT_SPECIFIER}'
8
- `;
9
- export const wireRootTsx = {
10
- key: 'root-tsx',
11
- title: `Inject side-effect import into ${REL}`,
12
- async preview(ctx) {
13
- return run(ctx, true);
14
- },
15
- async apply(ctx) {
16
- return run(ctx, false);
17
- },
18
- };
19
- async function run(ctx, dryRun) {
20
- const path = ctx.resolve(REL);
21
- if (!existsSync(path)) {
22
- return { status: 'blocked', message: `${REL} not found — host phase should have caught this` };
23
- }
24
- const text = readFileSync(path, 'utf8');
25
- if (hasImport(text, IMPORT_SPECIFIER)) {
26
- return { status: 'skipped', message: `${REL}: admin config import already present` };
27
- }
28
- if (dryRun) {
29
- return { status: 'done', message: `${REL}: will inject \`import '${IMPORT_SPECIFIER}'\`` };
30
- }
31
- const project = new Project({ useInMemoryFileSystem: false, skipAddingFilesFromTsConfig: true });
32
- let source;
33
- try {
34
- source = project.addSourceFileAtPath(path);
35
- }
36
- catch {
37
- return {
38
- status: 'manual',
39
- message: `${REL}: could not parse — please add the import manually`,
40
- snippet: SNIPPET,
41
- };
42
- }
43
- // Place after the last existing import — admin config registration only
44
- // needs to run once at module load; ordering with other side-effect
45
- // imports doesn't matter as long as it lands in the route module graph.
46
- const imports = source.getImportDeclarations();
47
- const insertIndex = imports.length;
48
- source.insertImportDeclaration(insertIndex, { moduleSpecifier: IMPORT_SPECIFIER });
49
- source.saveSync();
50
- return { status: 'done', message: `${REL}: injected \`import '${IMPORT_SPECIFIER}'\`` };
51
- }
52
- function hasImport(source, specifier) {
53
- const escaped = specifier.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
54
- const re = new RegExp(`import\\s+['"]${escaped}(?:\\.ts|\\.tsx)?['"]`);
55
- return re.test(source);
56
- }
57
- //# sourceMappingURL=root-tsx.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"root-tsx.js","sourceRoot":"","sources":["../../../src/phases/wire/root-tsx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAElD,OAAO,EAAE,OAAO,EAAmB,MAAM,UAAU,CAAA;AAKnD,MAAM,GAAG,GAAG,uBAAuB,CAAA;AACnC,MAAM,gBAAgB,GAAG,2BAA2B,CAAA;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