@quickback-dev/cli 0.60.1 → 0.60.3

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.
Files changed (75) hide show
  1. package/dist/commands/compile.d.ts.map +1 -1
  2. package/dist/commands/compile.js +1 -9
  3. package/dist/commands/compile.js.map +1 -1
  4. package/dist/commands/cursor.d.ts.map +1 -1
  5. package/dist/commands/cursor.js +6 -7
  6. package/dist/commands/cursor.js.map +1 -1
  7. package/dist/commands/deploy.d.ts.map +1 -1
  8. package/dist/commands/deploy.js +1 -9
  9. package/dist/commands/deploy.js.map +1 -1
  10. package/dist/commands/docs.d.ts.map +1 -1
  11. package/dist/commands/docs.js +3 -1
  12. package/dist/commands/docs.js.map +1 -1
  13. package/dist/commands/mcp.d.ts.map +1 -1
  14. package/dist/commands/mcp.js +3 -1
  15. package/dist/commands/mcp.js.map +1 -1
  16. package/dist/commands/migrations.d.ts.map +1 -1
  17. package/dist/commands/migrations.js +1 -9
  18. package/dist/commands/migrations.js.map +1 -1
  19. package/dist/docs/index.d.ts +25 -0
  20. package/dist/docs/index.d.ts.map +1 -0
  21. package/dist/docs/index.js +70 -0
  22. package/dist/docs/index.js.map +1 -0
  23. package/dist/docs/index.test.d.ts +2 -0
  24. package/dist/docs/index.test.d.ts.map +1 -0
  25. package/dist/docs/index.test.js +51 -0
  26. package/dist/docs/index.test.js.map +1 -0
  27. package/dist/index.js +1 -1
  28. package/dist/lib/auth.d.ts +0 -4
  29. package/dist/lib/auth.d.ts.map +1 -1
  30. package/dist/lib/auth.js +0 -16
  31. package/dist/lib/auth.js.map +1 -1
  32. package/dist/lib/compiler-stubs.d.ts +22 -67
  33. package/dist/lib/compiler-stubs.d.ts.map +1 -1
  34. package/dist/lib/compiler-stubs.js +35 -100
  35. package/dist/lib/compiler-stubs.js.map +1 -1
  36. package/dist/lib/copy-passthrough.d.ts +43 -0
  37. package/dist/lib/copy-passthrough.d.ts.map +1 -0
  38. package/dist/lib/copy-passthrough.js +118 -0
  39. package/dist/lib/copy-passthrough.js.map +1 -0
  40. package/dist/lib/copy-public-assets.d.ts +19 -22
  41. package/dist/lib/copy-public-assets.d.ts.map +1 -1
  42. package/dist/lib/copy-public-assets.js +20 -99
  43. package/dist/lib/copy-public-assets.js.map +1 -1
  44. package/dist/lib/copy-source-apps.d.ts +22 -20
  45. package/dist/lib/copy-source-apps.d.ts.map +1 -1
  46. package/dist/lib/copy-source-apps.js +21 -105
  47. package/dist/lib/copy-source-apps.js.map +1 -1
  48. package/dist/lib/file-writer.d.ts +0 -5
  49. package/dist/lib/file-writer.d.ts.map +1 -1
  50. package/dist/lib/file-writer.js +0 -17
  51. package/dist/lib/file-writer.js.map +1 -1
  52. package/dist/lib/prepare-output.d.ts.map +1 -1
  53. package/dist/lib/prepare-output.js +1 -9
  54. package/dist/lib/prepare-output.js.map +1 -1
  55. package/dist/skill/docs/configure/index.md +3 -0
  56. package/dist/skill/docs/platform/database/d1.md +98 -0
  57. package/dist/skill/docs/platform/database/neon.md +14 -7
  58. package/dist/skill/docs/start/deploy-browser.md +37 -2
  59. package/dist/templates/registry.d.ts +0 -5
  60. package/dist/templates/registry.d.ts.map +1 -1
  61. package/dist/templates/registry.js +0 -21
  62. package/dist/templates/registry.js.map +1 -1
  63. package/package.json +2 -3
  64. package/src/skill/docs/configure/index.md +3 -0
  65. package/src/skill/docs/platform/database/d1.md +98 -0
  66. package/src/skill/docs/platform/database/neon.md +14 -7
  67. package/src/skill/docs/start/deploy-browser.md +37 -2
  68. package/dist/docs/content.d.ts +0 -7
  69. package/dist/docs/content.d.ts.map +0 -1
  70. package/dist/docs/content.js +0 -737
  71. package/dist/docs/content.js.map +0 -1
  72. package/dist/lib/helpers.d.ts +0 -39
  73. package/dist/lib/helpers.d.ts.map +0 -1
  74. package/dist/lib/helpers.js +0 -299
  75. package/dist/lib/helpers.js.map +0 -1
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Shared passthrough copy for `quickback/<dir>/` → `<outputDir>/src/apps/`.
3
+ *
4
+ * Two conventions ride this path — `quickback/public/` (static binaries) and
5
+ * `quickback/apps/` (hand-authored companion mini-SPAs). They differ only in
6
+ * the source folder name, which subdirectories they prune, and the error type
7
+ * thrown on collision. Everything else — the walk, the manifest collision
8
+ * check, the bytewise `fs.copyFile` — is identical, so it lives here once.
9
+ *
10
+ * Why bytes, not strings: the compiler manifest is a utf-8 string channel,
11
+ * which corrupts PNGs / fonts / PDFs. Routing the copy through `fs.copyFile`
12
+ * keeps binaries intact and avoids a base64 round-trip through the API.
13
+ *
14
+ * Why after the wipe-and-write: `prepareGeneratedDir` wipes `src/` from the
15
+ * compiler's manifest, so every compile starts clean and copies fresh. Files
16
+ * removed from the source folder disappear on the next compile — no orphan
17
+ * tracking needed.
18
+ *
19
+ * Collisions with compiler-emitted paths (e.g. dropping `cms/index.html` and
20
+ * shadowing the SPA shell) are rejected rather than silently overwritten —
21
+ * silent overwrite would make a confused SPA build look like a broken compiler.
22
+ */
23
+ import { promises as fs } from 'fs';
24
+ import { join, relative, sep } from 'path';
25
+ const TARGET_PREFIX = join('src', 'apps');
26
+ /**
27
+ * Shared message body for the passthrough collision errors, so both read
28
+ * identically apart from the folder they name.
29
+ */
30
+ export function collisionMessage(dirName, collisions) {
31
+ return [
32
+ `quickback/${dirName}/ contains ${collisions.length} file(s) that would overwrite compiler output:`,
33
+ ...collisions.map((c) => ` • quickback/${dirName}/${c.relPath} → ${c.manifestPath} (already emitted by compiler)`),
34
+ `Rename or remove these files. Reserved subpaths under src/apps/ include cms/ and account/ when those SPAs are enabled.`,
35
+ ].join('\n');
36
+ }
37
+ /**
38
+ * Copy `<projectRoot>/quickback/<dirName>/**` into `<outputDir>/src/apps/**`.
39
+ *
40
+ * Returns `{ copied: 0 }` when the source folder is absent — both folders are
41
+ * opt-in conventions, not required directories.
42
+ */
43
+ export async function copyPassthrough(spec, options) {
44
+ const sourceDir = join(options.projectRoot, 'quickback', spec.dirName);
45
+ if (!(await isDirectory(sourceDir))) {
46
+ return { copied: 0, destPaths: [] };
47
+ }
48
+ const sources = await collectFiles(sourceDir, spec.skipDirs);
49
+ if (sources.length === 0) {
50
+ return { copied: 0, sourceDir, destPaths: [] };
51
+ }
52
+ const manifestSet = new Set();
53
+ for (const p of options.manifestPaths)
54
+ manifestSet.add(toPosix(p));
55
+ const collisions = [];
56
+ const destPaths = [];
57
+ for (const rel of sources) {
58
+ const dest = join(TARGET_PREFIX, rel);
59
+ const destPosix = toPosix(dest);
60
+ if (manifestSet.has(destPosix)) {
61
+ collisions.push({ relPath: toPosix(rel), manifestPath: destPosix });
62
+ }
63
+ destPaths.push(dest);
64
+ }
65
+ if (collisions.length > 0) {
66
+ throw spec.collisionError(collisions);
67
+ }
68
+ for (const rel of sources) {
69
+ const src = join(sourceDir, rel);
70
+ const dest = join(options.outputDir, TARGET_PREFIX, rel);
71
+ await fs.mkdir(join(dest, '..'), { recursive: true });
72
+ await fs.copyFile(src, dest);
73
+ }
74
+ return { copied: sources.length, sourceDir, destPaths };
75
+ }
76
+ async function isDirectory(p) {
77
+ try {
78
+ const s = await fs.stat(p);
79
+ return s.isDirectory();
80
+ }
81
+ catch {
82
+ return false;
83
+ }
84
+ }
85
+ /**
86
+ * Walk a directory tree and return every regular file as a path relative to
87
+ * the root. Hidden entries (`.DS_Store`, `.git/`, dotfiles) are always
88
+ * skipped — the user did not drop those in intentionally and they break
89
+ * worker asset bindings. `skipDirs` prunes build output (`node_modules/`,
90
+ * `dist/`, …) for the source-app lane; bundling those would inflate the
91
+ * worker output.
92
+ */
93
+ async function collectFiles(root, skipDirs) {
94
+ const out = [];
95
+ async function walk(dir) {
96
+ const entries = await fs.readdir(dir, { withFileTypes: true });
97
+ for (const entry of entries) {
98
+ if (entry.name.startsWith('.'))
99
+ continue;
100
+ if (entry.isDirectory() && skipDirs?.has(entry.name))
101
+ continue;
102
+ const full = join(dir, entry.name);
103
+ if (entry.isDirectory()) {
104
+ await walk(full);
105
+ }
106
+ else if (entry.isFile()) {
107
+ out.push(relative(root, full));
108
+ }
109
+ }
110
+ }
111
+ await walk(root);
112
+ out.sort();
113
+ return out;
114
+ }
115
+ function toPosix(p) {
116
+ return sep === '/' ? p : p.split(sep).join('/');
117
+ }
118
+ //# sourceMappingURL=copy-passthrough.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-passthrough.js","sourceRoot":"","sources":["../../src/lib/copy-passthrough.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAE3C,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAoC1C;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe,EAAE,UAAkC;IAClF,OAAO;QACL,aAAa,OAAO,cAAc,UAAU,CAAC,MAAM,gDAAgD;QACnG,GAAG,UAAU,CAAC,GAAG,CACf,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,OAAO,IAAI,CAAC,CAAC,OAAO,MAAM,CAAC,CAAC,YAAY,gCAAgC,CACjG;QACD,wHAAwH;KACzH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,IAAqB,EACrB,OAA2B;IAE3B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACvE,IAAI,CAAC,CAAC,MAAM,WAAW,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;QACpC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IACtC,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,SAAS,EA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,EAAE,IAAI,CAAC,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;IACH,CAAC;IACD,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,GAAG,CAAC,IAAI,EAAE,CAAC;IACX,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,OAAO,CAAC,CAAS;IACxB,OAAO,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,CAAC"}
@@ -1,34 +1,31 @@
1
- export interface CopyPublicAssetsOptions {
2
- /** Project root — the parent of the `quickback/` folder. */
3
- projectRoot: string;
4
- /** Output root — where `src/` lives. Usually equals projectRoot. */
5
- outputDir: string;
6
- /** Paths the compiler is writing this run, relative to outputDir. */
7
- manifestPaths: Iterable<string>;
8
- }
9
- export interface CopyPublicAssetsResult {
10
- /** Number of files copied. Zero when the folder is missing or empty. */
11
- copied: number;
12
- /** Absolute path of the source folder, for logging — undefined when missing. */
13
- sourceDir?: string;
14
- /** Final destination paths, relative to outputDir. */
15
- destPaths: string[];
16
- }
1
+ /**
2
+ * Static-asset passthrough for `quickback/public/`.
3
+ *
4
+ * Anything under `<projectRoot>/quickback/public/` is copied verbatim into
5
+ * `<outputDir>/src/apps/`, preserving directory structure. The compiler never
6
+ * sees these files — they ride past it as bytes and land in the Cloudflare
7
+ * ASSETS directory the worker already binds for the SPAs.
8
+ *
9
+ * Use this folder for static binaries (logos, fonts, OG images, robots.txt).
10
+ * Hand-authored companion mini-SPAs belong in `quickback/apps/` instead — see
11
+ * `copy-source-apps.ts`. The copy mechanics for both live in
12
+ * `copy-passthrough.ts`; this module supplies the folder name and error type.
13
+ */
14
+ import { type PassthroughCollision, type PassthroughOptions, type PassthroughResult } from './copy-passthrough.js';
15
+ export type CopyPublicAssetsOptions = PassthroughOptions;
16
+ export type CopyPublicAssetsResult = PassthroughResult;
17
17
  export declare class PublicAssetCollisionError extends Error {
18
18
  readonly collisions: Array<{
19
19
  publicPath: string;
20
20
  manifestPath: string;
21
21
  }>;
22
- constructor(collisions: Array<{
23
- publicPath: string;
24
- manifestPath: string;
25
- }>);
22
+ constructor(collisions: PassthroughCollision[]);
26
23
  }
27
24
  /**
28
25
  * Copy `<projectRoot>/quickback/public/**` into `<outputDir>/src/apps/**`.
29
26
  *
30
- * Returns `{ copied: 0 }` when the source folder is absent — public/ is
31
- * an opt-in convention, not a required directory.
27
+ * Returns `{ copied: 0 }` when the source folder is absent — public/ is an
28
+ * opt-in convention, not a required directory.
32
29
  */
33
30
  export declare function copyPublicAssets(options: CopyPublicAssetsOptions): Promise<CopyPublicAssetsResult>;
34
31
  //# sourceMappingURL=copy-public-assets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"copy-public-assets.d.ts","sourceRoot":"","sources":["../../src/lib/copy-public-assets.ts"],"names":[],"mappings":"AA6BA,MAAM,WAAW,uBAAuB;IACtC,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,sBAAsB;IACrC,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;gBAE7D,UAAU,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;CAc5E;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,sBAAsB,CAAC,CAoCjC"}
1
+ {"version":3,"file":"copy-public-assets.d.ts","sourceRoot":"","sources":["../../src/lib/copy-public-assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAI/B,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,CAAC;AACzD,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC;AAEvD,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;gBAE7D,UAAU,EAAE,oBAAoB,EAAE;CAQ/C;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,sBAAsB,CAAC,CAQjC"}
@@ -2,117 +2,38 @@
2
2
  * Static-asset passthrough for `quickback/public/`.
3
3
  *
4
4
  * Anything under `<projectRoot>/quickback/public/` is copied verbatim into
5
- * `<outputDir>/src/apps/`, preserving directory structure. The compiler
6
- * never sees these files — they ride past it as bytes and land in the
7
- * Cloudflare ASSETS directory the worker already binds for the SPAs.
5
+ * `<outputDir>/src/apps/`, preserving directory structure. The compiler never
6
+ * sees these files — they ride past it as bytes and land in the Cloudflare
7
+ * ASSETS directory the worker already binds for the SPAs.
8
8
  *
9
- * Why bytes, not strings: `writeFilesWithMerge` writes `content` as utf-8,
10
- * which corrupts PNGs / fonts / PDFs. Routing the copy through a separate
11
- * `fs.copyFile` step keeps binaries intact and avoids a base64 round-trip
12
- * through the compiler API.
13
- *
14
- * Why after the wipe-and-write: `prepareGeneratedDir` wipes `src/` based on
15
- * the compiler's manifest, so on every compile we start clean and copy
16
- * fresh. Files removed from `quickback/public/` disappear automatically on
17
- * the next compile — no orphan tracking needed.
18
- *
19
- * Collisions with compiler-emitted paths (e.g. a user dropping
20
- * `cms/index.html` into public/ and shadowing the SPA shell) are rejected
21
- * with a clear error rather than silently overwritten — silent overwrite
22
- * would make a confused SPA build look like a broken compiler.
9
+ * Use this folder for static binaries (logos, fonts, OG images, robots.txt).
10
+ * Hand-authored companion mini-SPAs belong in `quickback/apps/` instead — see
11
+ * `copy-source-apps.ts`. The copy mechanics for both live in
12
+ * `copy-passthrough.ts`; this module supplies the folder name and error type.
23
13
  */
24
- import { promises as fs } from 'fs';
25
- import { join, relative, sep } from 'path';
14
+ import { collisionMessage, copyPassthrough, } from './copy-passthrough.js';
26
15
  const PUBLIC_DIR_NAME = 'public';
27
- const TARGET_PREFIX = join('src', 'apps');
28
16
  export class PublicAssetCollisionError extends Error {
29
17
  collisions;
30
18
  constructor(collisions) {
31
- const lines = collisions.map((c) => ` • quickback/${PUBLIC_DIR_NAME}/${c.publicPath} → ${c.manifestPath} (already emitted by compiler)`);
32
- super([
33
- `quickback/${PUBLIC_DIR_NAME}/ contains ${collisions.length} file(s) that would overwrite compiler output:`,
34
- ...lines,
35
- `Rename or remove these files. Reserved subpaths under src/apps/ include cms/ and account/ when those SPAs are enabled.`,
36
- ].join('\n'));
19
+ super(collisionMessage(PUBLIC_DIR_NAME, collisions));
37
20
  this.name = 'PublicAssetCollisionError';
38
- this.collisions = collisions;
21
+ this.collisions = collisions.map((c) => ({
22
+ publicPath: c.relPath,
23
+ manifestPath: c.manifestPath,
24
+ }));
39
25
  }
40
26
  }
41
27
  /**
42
28
  * Copy `<projectRoot>/quickback/public/**` into `<outputDir>/src/apps/**`.
43
29
  *
44
- * Returns `{ copied: 0 }` when the source folder is absent — public/ is
45
- * an opt-in convention, not a required directory.
30
+ * Returns `{ copied: 0 }` when the source folder is absent — public/ is an
31
+ * opt-in convention, not a required directory.
46
32
  */
47
- export async function copyPublicAssets(options) {
48
- const sourceDir = join(options.projectRoot, 'quickback', PUBLIC_DIR_NAME);
49
- if (!(await isDirectory(sourceDir))) {
50
- return { copied: 0, destPaths: [] };
51
- }
52
- const sources = await collectFiles(sourceDir);
53
- if (sources.length === 0) {
54
- return { copied: 0, sourceDir, destPaths: [] };
55
- }
56
- const manifestSet = new Set();
57
- for (const p of options.manifestPaths)
58
- manifestSet.add(toPosix(p));
59
- const collisions = [];
60
- const destPaths = [];
61
- for (const rel of sources) {
62
- const dest = join(TARGET_PREFIX, rel);
63
- const destPosix = toPosix(dest);
64
- if (manifestSet.has(destPosix)) {
65
- collisions.push({ publicPath: toPosix(rel), manifestPath: destPosix });
66
- }
67
- destPaths.push(dest);
68
- }
69
- if (collisions.length > 0) {
70
- throw new PublicAssetCollisionError(collisions);
71
- }
72
- for (const rel of sources) {
73
- const src = join(sourceDir, rel);
74
- const dest = join(options.outputDir, TARGET_PREFIX, rel);
75
- await fs.mkdir(join(dest, '..'), { recursive: true });
76
- await fs.copyFile(src, dest);
77
- }
78
- return { copied: sources.length, sourceDir, destPaths };
79
- }
80
- async function isDirectory(p) {
81
- try {
82
- const s = await fs.stat(p);
83
- return s.isDirectory();
84
- }
85
- catch {
86
- return false;
87
- }
88
- }
89
- /**
90
- * Walk a directory tree and return every regular file as a path relative
91
- * to the root. Hidden entries (`.DS_Store`, `.git/`, etc.) are skipped —
92
- * the user did not "drop these in public/" intentionally and they break
93
- * worker asset bindings.
94
- */
95
- async function collectFiles(root) {
96
- const out = [];
97
- async function walk(dir) {
98
- const entries = await fs.readdir(dir, { withFileTypes: true });
99
- for (const entry of entries) {
100
- if (entry.name.startsWith('.'))
101
- continue;
102
- const full = join(dir, entry.name);
103
- if (entry.isDirectory()) {
104
- await walk(full);
105
- }
106
- else if (entry.isFile()) {
107
- out.push(relative(root, full));
108
- }
109
- }
110
- }
111
- await walk(root);
112
- out.sort();
113
- return out;
114
- }
115
- function toPosix(p) {
116
- return sep === '/' ? p : p.split(sep).join('/');
33
+ export function copyPublicAssets(options) {
34
+ return copyPassthrough({
35
+ dirName: PUBLIC_DIR_NAME,
36
+ collisionError: (collisions) => new PublicAssetCollisionError(collisions),
37
+ }, options);
117
38
  }
118
39
  //# sourceMappingURL=copy-public-assets.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"copy-public-assets.js","sourceRoot":"","sources":["../../src/lib/copy-public-assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAE3C,MAAM,eAAe,GAAG,QAAQ,CAAC;AACjC,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAoB1C,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IACzC,UAAU,CAAsD;IAEzE,YAAY,UAA+D;QACzE,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAC1B,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,eAAe,IAAI,CAAC,CAAC,UAAU,MAAM,CAAC,CAAC,YAAY,gCAAgC,CAC5G,CAAC;QACF,KAAK,CACH;YACE,aAAa,eAAe,cAAc,UAAU,CAAC,MAAM,gDAAgD;YAC3G,GAAG,KAAK;YACR,wHAAwH;SACzH,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;QACxC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAgC;IAEhC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC;IAC1E,IAAI,CAAC,CAAC,MAAM,WAAW,CA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
1
- export interface CopySourceAppsOptions {
2
- /** Project root — the parent of the `quickback/` folder. */
3
- projectRoot: string;
4
- /** Output root — where `src/` lives. Usually equals projectRoot. */
5
- outputDir: string;
6
- /** Paths the compiler is writing this run, relative to outputDir. */
7
- manifestPaths: Iterable<string>;
8
- }
9
- export interface CopySourceAppsResult {
10
- /** Number of files copied. Zero when the folder is missing or empty. */
11
- copied: number;
12
- /** Absolute path of the source folder, for logging — undefined when missing. */
13
- sourceDir?: string;
14
- /** Final destination paths, relative to outputDir. */
15
- destPaths: string[];
16
- }
1
+ /**
2
+ * Source-app passthrough for `quickback/apps/`.
3
+ *
4
+ * Anything under `<projectRoot>/quickback/apps/<name>/` is copied verbatim
5
+ * into `<outputDir>/src/apps/<name>/`, preserving directory structure. The
6
+ * compiler never sees these files — they land alongside the SPA shells it
7
+ * emits (`cms/`, `account/`).
8
+ *
9
+ * Why a separate folder from `quickback/public/`: `public/` is for static
10
+ * binary assets (logos, fonts, OG images). This folder is for hand-authored
11
+ * TypeScript / JavaScript / TSX — companion mini-SPAs (e.g. `m/`, `admin/`).
12
+ * Different conventions, different ergonomics: this lane additionally prunes
13
+ * `node_modules/`, `dist/`, `build/` and friends so a casual `bun install`
14
+ * inside an app folder doesn't drag the world into the worker bundle.
15
+ *
16
+ * The copy mechanics for both lanes live in `copy-passthrough.ts`; this
17
+ * module supplies the folder name, the prune set, and the error type.
18
+ */
19
+ import { type PassthroughCollision, type PassthroughOptions, type PassthroughResult } from './copy-passthrough.js';
20
+ export type CopySourceAppsOptions = PassthroughOptions;
21
+ export type CopySourceAppsResult = PassthroughResult;
17
22
  export declare class SourceAppCollisionError extends Error {
18
23
  readonly collisions: Array<{
19
24
  sourcePath: string;
20
25
  manifestPath: string;
21
26
  }>;
22
- constructor(collisions: Array<{
23
- sourcePath: string;
24
- manifestPath: string;
25
- }>);
27
+ constructor(collisions: PassthroughCollision[]);
26
28
  }
27
29
  /**
28
30
  * Copy `<projectRoot>/quickback/apps/**` into `<outputDir>/src/apps/**`.
@@ -1 +1 @@
1
- {"version":3,"file":"copy-source-apps.d.ts","sourceRoot":"","sources":["../../src/lib/copy-source-apps.ts"],"names":[],"mappings":"AA6CA,MAAM,WAAW,qBAAqB;IACpC,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,oBAAoB;IACnC,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;gBAE7D,UAAU,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;CAc5E;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CAoC/B"}
1
+ {"version":3,"file":"copy-source-apps.d.ts","sourceRoot":"","sources":["../../src/lib/copy-source-apps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAY/B,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AACvD,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAErD,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;gBAE7D,UAAU,EAAE,oBAAoB,EAAE;CAQ/C;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CAS/B"}
@@ -3,36 +3,21 @@
3
3
  *
4
4
  * Anything under `<projectRoot>/quickback/apps/<name>/` is copied verbatim
5
5
  * into `<outputDir>/src/apps/<name>/`, preserving directory structure. The
6
- * compiler never sees these files — they ride past it as bytes and land
7
- * alongside the SPA shells the compiler emits.
6
+ * compiler never sees these files — they land alongside the SPA shells it
7
+ * emits (`cms/`, `account/`).
8
8
  *
9
9
  * Why a separate folder from `quickback/public/`: `public/` is for static
10
- * binary assets (logos, fonts, OG images) that ride past the worker as
11
- * bytes. `apps/` is for hand-authored TypeScript / JavaScript / TSX apps
12
- * — companion mini-SPAs (e.g. `m/`, `admin/`) that live alongside the
13
- * compiler-emitted `cms/` and `account/` shells. Different conventions,
14
- * different ergonomics: this folder additionally skips `node_modules/`,
15
- * `dist/`, and `build/` so a casual `bun install` inside a hand-authored
16
- * app folder doesn't drag the world into the worker bundle.
10
+ * binary assets (logos, fonts, OG images). This folder is for hand-authored
11
+ * TypeScript / JavaScript / TSX — companion mini-SPAs (e.g. `m/`, `admin/`).
12
+ * Different conventions, different ergonomics: this lane additionally prunes
13
+ * `node_modules/`, `dist/`, `build/` and friends so a casual `bun install`
14
+ * inside an app folder doesn't drag the world into the worker bundle.
17
15
  *
18
- * Why bytes, not strings: the compiler manifest is a utf-8 string channel
19
- * which is fine for source code in practice, but corrupts any binary fixture
20
- * a source-authored app might bundle (sprite sheets, sample WAVs, etc.).
21
- * Routing the copy through `fs.copyFile` keeps everything intact.
22
- *
23
- * Why after the wipe-and-write: `prepareGeneratedDir` wipes `src/` based on
24
- * the compiler manifest. We restore the user's hand-authored tree on top of
25
- * the fresh write. Files removed from `quickback/apps/` disappear on the
26
- * next compile — no orphan tracking needed.
27
- *
28
- * Collisions with compiler-emitted paths (e.g. dropping a hand-authored
29
- * `cms/index.tsx` that would shadow the SPA shell) are rejected with a
30
- * clear error rather than silently overwritten.
16
+ * The copy mechanics for both lanes live in `copy-passthrough.ts`; this
17
+ * module supplies the folder name, the prune set, and the error type.
31
18
  */
32
- import { promises as fs } from 'fs';
33
- import { join, relative, sep } from 'path';
19
+ import { collisionMessage, copyPassthrough, } from './copy-passthrough.js';
34
20
  const APPS_DIR_NAME = 'apps';
35
- const TARGET_PREFIX = join('src', 'apps');
36
21
  /**
37
22
  * Subdirectories we never copy. Symmetric with what a developer would
38
23
  * `.gitignore` inside a hand-authored app folder. Not configurable for now —
@@ -43,14 +28,12 @@ const SKIP_DIRS = new Set(['node_modules', 'dist', 'build', '.next', '.turbo', '
43
28
  export class SourceAppCollisionError extends Error {
44
29
  collisions;
45
30
  constructor(collisions) {
46
- const lines = collisions.map((c) => ` • quickback/${APPS_DIR_NAME}/${c.sourcePath} → ${c.manifestPath} (already emitted by compiler)`);
47
- super([
48
- `quickback/${APPS_DIR_NAME}/ contains ${collisions.length} file(s) that would overwrite compiler output:`,
49
- ...lines,
50
- `Rename or remove these files. Reserved subpaths under src/apps/ include cms/ and account/ when those SPAs are enabled.`,
51
- ].join('\n'));
31
+ super(collisionMessage(APPS_DIR_NAME, collisions));
52
32
  this.name = 'SourceAppCollisionError';
53
- this.collisions = collisions;
33
+ this.collisions = collisions.map((c) => ({
34
+ sourcePath: c.relPath,
35
+ manifestPath: c.manifestPath,
36
+ }));
54
37
  }
55
38
  }
56
39
  /**
@@ -59,78 +42,11 @@ export class SourceAppCollisionError extends Error {
59
42
  * Returns `{ copied: 0 }` when the source folder is absent — apps/ is an
60
43
  * opt-in convention, not a required directory.
61
44
  */
62
- export async function copySourceApps(options) {
63
- const sourceDir = join(options.projectRoot, 'quickback', APPS_DIR_NAME);
64
- if (!(await isDirectory(sourceDir))) {
65
- return { copied: 0, destPaths: [] };
66
- }
67
- const sources = await collectFiles(sourceDir);
68
- if (sources.length === 0) {
69
- return { copied: 0, sourceDir, destPaths: [] };
70
- }
71
- const manifestSet = new Set();
72
- for (const p of options.manifestPaths)
73
- manifestSet.add(toPosix(p));
74
- const collisions = [];
75
- const destPaths = [];
76
- for (const rel of sources) {
77
- const dest = join(TARGET_PREFIX, rel);
78
- const destPosix = toPosix(dest);
79
- if (manifestSet.has(destPosix)) {
80
- collisions.push({ sourcePath: toPosix(rel), manifestPath: destPosix });
81
- }
82
- destPaths.push(dest);
83
- }
84
- if (collisions.length > 0) {
85
- throw new SourceAppCollisionError(collisions);
86
- }
87
- for (const rel of sources) {
88
- const src = join(sourceDir, rel);
89
- const dest = join(options.outputDir, TARGET_PREFIX, rel);
90
- await fs.mkdir(join(dest, '..'), { recursive: true });
91
- await fs.copyFile(src, dest);
92
- }
93
- return { copied: sources.length, sourceDir, destPaths };
94
- }
95
- async function isDirectory(p) {
96
- try {
97
- const s = await fs.stat(p);
98
- return s.isDirectory();
99
- }
100
- catch {
101
- return false;
102
- }
103
- }
104
- /**
105
- * Walk a directory tree and return every regular file as a path relative
106
- * to the root. Hidden entries (`.DS_Store`, `.git/`, dotfiles) and the
107
- * `SKIP_DIRS` set (`node_modules/`, `dist/`, `build/`, etc.) are pruned —
108
- * accidentally bundling those would inflate the worker output and was a
109
- * top reason `quickback/public/` couldn't simply absorb this use case.
110
- */
111
- async function collectFiles(root) {
112
- const out = [];
113
- async function walk(dir) {
114
- const entries = await fs.readdir(dir, { withFileTypes: true });
115
- for (const entry of entries) {
116
- if (entry.name.startsWith('.'))
117
- continue;
118
- if (entry.isDirectory() && SKIP_DIRS.has(entry.name))
119
- continue;
120
- const full = join(dir, entry.name);
121
- if (entry.isDirectory()) {
122
- await walk(full);
123
- }
124
- else if (entry.isFile()) {
125
- out.push(relative(root, full));
126
- }
127
- }
128
- }
129
- await walk(root);
130
- out.sort();
131
- return out;
132
- }
133
- function toPosix(p) {
134
- return sep === '/' ? p : p.split(sep).join('/');
45
+ export function copySourceApps(options) {
46
+ return copyPassthrough({
47
+ dirName: APPS_DIR_NAME,
48
+ skipDirs: SKIP_DIRS,
49
+ collisionError: (collisions) => new SourceAppCollisionError(collisions),
50
+ }, options);
135
51
  }
136
52
  //# sourceMappingURL=copy-source-apps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"copy-source-apps.js","sourceRoot":"","sources":["../../src/lib/copy-source-apps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAE3C,MAAM,aAAa,GAAG,MAAM,CAAC;AAC7B,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAoB1F,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IACvC,UAAU,CAAsD;IAEzE,YAAY,UAA+D;QACzE,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAC1B,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,aAAa,IAAI,CAAC,CAAC,UAAU,MAAM,CAAC,CAAC,YAAY,gCAAgC,CAC1G,CAAC;QACF,KAAK,CACH;YACE,aAAa,aAAa,cAAc,UAAU,CAAC,MAAM,gDAAgD;YACzG,GAAG,KAAK;YACR,wHAAwH;SACzH,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CAC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AyB,CAAC;QACtC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvC,UAAU,EAAE,CAAC,CAAC,OAAO;YACrB,YAAY,EAAE,CAAC,CAAC,YAAY;SAC7B,CAAC,CAAC,CAAC;IACN,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,OAA8B;IAE9B,OAAO,eAAe,CACpB;QACE,OAAO,EAAE,aAAa;QACtB,QAAQ,EAAE,SAAS;QACnB,cAAc,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,uBAAuB,CAAC,UAAU,CAAC;KACxE,EACD,OAAO,CACR,CAAC;AACJ,CAAC"}
@@ -9,7 +9,6 @@ export interface GeneratedFile {
9
9
  type?: string;
10
10
  feature?: string;
11
11
  }
12
- export declare function cleanOutputDir(dir: string): Promise<void>;
13
12
  /**
14
13
  * Write generated files to disk (overwrites all)
15
14
  */
@@ -23,8 +22,4 @@ export declare function writeFiles(outputDir: string, files: GeneratedFile[]): P
23
22
  * - Config files: Overwrite
24
23
  */
25
24
  export declare function writeFilesWithMerge(outputDir: string, files: GeneratedFile[]): Promise<void>;
26
- /**
27
- * Write a single file
28
- */
29
- export declare function writeFile(filePath: string, content: string): Promise<void>;
30
25
  //# sourceMappingURL=file-writer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-writer.d.ts","sourceRoot":"","sources":["../../src/lib/file-writer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAOD,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK/D;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAWzF;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BlG;AAkED;;GAEG;AACH,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKhF"}
1
+ {"version":3,"file":"file-writer.d.ts","sourceRoot":"","sources":["../../src/lib/file-writer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID;;GAEG;AACH,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAWzF;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BlG"}
@@ -6,16 +6,7 @@
6
6
  import { promises as fs } from 'fs';
7
7
  import { join, dirname } from 'path';
8
8
  import { pathExists, runWithLimit } from './async-utils.js';
9
- /**
10
- * Clean and recreate output directory (used for testing only)
11
- */
12
9
  const WRITE_CONCURRENCY = 16;
13
- export async function cleanOutputDir(dir) {
14
- if (await pathExists(dir)) {
15
- await fs.rm(dir, { recursive: true, force: true });
16
- }
17
- await fs.mkdir(dir, { recursive: true });
18
- }
19
10
  /**
20
11
  * Write generated files to disk (overwrites all)
21
12
  */
@@ -126,12 +117,4 @@ async function mergePackageJson(existingPath, newContent) {
126
117
  return newContent;
127
118
  }
128
119
  }
129
- /**
130
- * Write a single file
131
- */
132
- export async function writeFile(filePath, content) {
133
- const dir = dirname(filePath);
134
- await fs.mkdir(dir, { recursive: true });
135
- await fs.writeFile(filePath, content, 'utf-8');
136
- }
137
120
  //# sourceMappingURL=file-writer.js.map