@quickback-dev/cli 0.60.0 → 0.60.2

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 (82) hide show
  1. package/dist/commands/compile.d.ts.map +1 -1
  2. package/dist/commands/compile.js +42 -14
  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/api-client.d.ts +15 -0
  29. package/dist/lib/api-client.d.ts.map +1 -1
  30. package/dist/lib/api-client.js.map +1 -1
  31. package/dist/lib/auth.d.ts +0 -4
  32. package/dist/lib/auth.d.ts.map +1 -1
  33. package/dist/lib/auth.js +0 -16
  34. package/dist/lib/auth.js.map +1 -1
  35. package/dist/lib/compiler-stubs.d.ts +22 -67
  36. package/dist/lib/compiler-stubs.d.ts.map +1 -1
  37. package/dist/lib/compiler-stubs.js +35 -100
  38. package/dist/lib/compiler-stubs.js.map +1 -1
  39. package/dist/lib/copy-passthrough.d.ts +43 -0
  40. package/dist/lib/copy-passthrough.d.ts.map +1 -0
  41. package/dist/lib/copy-passthrough.js +118 -0
  42. package/dist/lib/copy-passthrough.js.map +1 -0
  43. package/dist/lib/copy-public-assets.d.ts +19 -22
  44. package/dist/lib/copy-public-assets.d.ts.map +1 -1
  45. package/dist/lib/copy-public-assets.js +20 -99
  46. package/dist/lib/copy-public-assets.js.map +1 -1
  47. package/dist/lib/copy-source-apps.d.ts +22 -20
  48. package/dist/lib/copy-source-apps.d.ts.map +1 -1
  49. package/dist/lib/copy-source-apps.js +21 -105
  50. package/dist/lib/copy-source-apps.js.map +1 -1
  51. package/dist/lib/file-writer.d.ts +0 -5
  52. package/dist/lib/file-writer.d.ts.map +1 -1
  53. package/dist/lib/file-writer.js +0 -17
  54. package/dist/lib/file-writer.js.map +1 -1
  55. package/dist/lib/prepare-output.d.ts.map +1 -1
  56. package/dist/lib/prepare-output.js +1 -9
  57. package/dist/lib/prepare-output.js.map +1 -1
  58. package/dist/skill/docs/changelog/index.md +49 -3
  59. package/dist/skill/docs/configure/index.md +3 -0
  60. package/dist/skill/docs/platform/database/d1.md +98 -0
  61. package/dist/skill/docs/platform/database/neon.md +14 -7
  62. package/dist/skill/docs/start/deploy-browser.md +35 -1
  63. package/dist/skill/docs/tooling/output.md +36 -0
  64. package/dist/templates/registry.d.ts +0 -5
  65. package/dist/templates/registry.d.ts.map +1 -1
  66. package/dist/templates/registry.js +0 -21
  67. package/dist/templates/registry.js.map +1 -1
  68. package/package.json +2 -3
  69. package/src/skill/docs/changelog/index.md +49 -3
  70. package/src/skill/docs/configure/index.md +3 -0
  71. package/src/skill/docs/platform/database/d1.md +98 -0
  72. package/src/skill/docs/platform/database/neon.md +14 -7
  73. package/src/skill/docs/start/deploy-browser.md +35 -1
  74. package/src/skill/docs/tooling/output.md +36 -0
  75. package/dist/docs/content.d.ts +0 -7
  76. package/dist/docs/content.d.ts.map +0 -1
  77. package/dist/docs/content.js +0 -737
  78. package/dist/docs/content.js.map +0 -1
  79. package/dist/lib/helpers.d.ts +0 -39
  80. package/dist/lib/helpers.d.ts.map +0 -1
  81. package/dist/lib/helpers.js +0 -299
  82. package/dist/lib/helpers.js.map +0 -1
@@ -7,62 +7,42 @@
7
7
  * The actual validation happens server-side in the compiler worker.
8
8
  */
9
9
  /**
10
- * Stub for defineConfig - just returns the config as-is
11
- */
12
- export function defineConfig(config) {
13
- return config;
14
- }
15
- /**
16
- * Stub for defineRuntime - returns provider config
17
- */
18
- export function defineRuntime(name, config) {
19
- return { name, config: config || {} };
20
- }
21
- /**
22
- * Stub for defineDatabase - returns provider config
23
- */
24
- export function defineDatabase(name, config) {
25
- return { name, config: config || {} };
26
- }
27
- /**
28
- * Stub for defineAuth - returns provider config
29
- */
30
- export function defineAuth(name, config) {
31
- return { name, config: config || {} };
32
- }
33
- /**
34
- * Stub for defineStorage - returns provider config
35
- */
36
- export function defineStorage(name, config) {
37
- return { name, config: config || {} };
38
- }
39
- /**
40
- * Stub for defineFileStorage - returns provider config for R2 file storage
41
- */
42
- export function defineFileStorage(name, config) {
43
- return { name, config: config || {} };
44
- }
45
- /**
46
- * Stub for defineResource - just returns the config with schema reference
47
- */
48
- export function defineResource(schema, config) {
49
- return {
50
- ...config,
51
- __schema: schema,
52
- };
53
- }
54
- /**
55
- * Stub for defineTable - combines schema with all configuration
10
+ * Most stubs are one of two shapes, so they're built from two helpers rather
11
+ * than written out eleven times:
56
12
  *
57
- * This is the new unified API that combines schema definition with
58
- * all configuration (firewall, guards, crud, embeddings, realtime) in one place.
59
- */
60
- export function defineTable(schema, config) {
61
- return {
62
- ...config,
63
- __schema: schema,
64
- };
65
- }
13
+ * - `identity` — the definition is transported verbatim and validated
14
+ * server-side (defineConfig, defineArea, defineQueue, defineRealtime,
15
+ * defineEmbedding, definePage).
16
+ * - `provider` — `(name, config)` collapsed to `{ name, config }`
17
+ * (defineRuntime, defineDatabase, defineAuth, defineStorage,
18
+ * defineFileStorage).
19
+ *
20
+ * `defineTable` / `defineResource` / `defineActions` additionally stash the
21
+ * schema reference under `__schema`.
22
+ */
23
+ const identity = (definition) => definition;
24
+ const provider = (name, config) => ({ name, config: config || {} });
25
+ const withSchema = (schema, config) => ({ ...config, __schema: schema });
26
+ export const defineConfig = (identity);
27
+ /** Used in features/<area>/_area.ts. The compiler re-validates server-side. */
28
+ export const defineArea = (identity);
29
+ /** Used in services/queues/*.ts */
30
+ export const defineQueue = (identity);
31
+ /** Used in services/realtime/*.ts */
32
+ export const defineRealtime = (identity);
33
+ /** Used in services/embeddings/*.ts */
34
+ export const defineEmbedding = (identity);
35
+ /** Used in features/{feature}/pages/*.ts */
36
+ export const definePage = (identity);
37
+ export const defineRuntime = provider;
38
+ export const defineDatabase = provider;
39
+ export const defineAuth = provider;
40
+ export const defineStorage = provider;
41
+ export const defineFileStorage = provider;
42
+ /** Unified schema + configuration (firewall, guards, crud, embeddings, realtime). */
43
+ export const defineTable = withSchema;
44
+ export const defineResource = withSchema;
45
+ export const defineActions = withSchema;
66
46
  /**
67
47
  * Stub for the `q` schema DSL. Returns chainable column builders and a `table`
68
48
  * function that collects columns into a placeholder object. The CLI never
@@ -96,57 +76,12 @@ export const q = {
96
76
  enum: (_values, _name) => makeQColumn(),
97
77
  id: () => makeQColumn(),
98
78
  };
99
- /**
100
- * Stub for defineActions - just returns the actions with schema reference
101
- */
102
- export function defineActions(schema, actions) {
103
- return {
104
- ...actions,
105
- __schema: schema,
106
- };
107
- }
108
79
  /**
109
80
  * Stub for defineAction - returns a curried function that returns the config
110
81
  */
111
82
  export function defineAction() {
112
83
  return (config) => config;
113
84
  }
114
- /**
115
- * Stub for defineArea - returns the area definition as-is.
116
- * Used in features/<area>/_area.ts (feature areas). The compiler
117
- * re-validates the transported definition server-side.
118
- */
119
- export function defineArea(definition) {
120
- return definition;
121
- }
122
- /**
123
- * Stub for defineQueue - returns the queue handler definition
124
- * Used in definitions/services/queues/*.ts
125
- */
126
- export function defineQueue(config) {
127
- return config;
128
- }
129
- /**
130
- * Stub for defineRealtime - returns the realtime definition
131
- * Used in definitions/services/realtime/*.ts
132
- */
133
- export function defineRealtime(config) {
134
- return config;
135
- }
136
- /**
137
- * Stub for defineEmbedding - returns the embedding definition
138
- * Used in definitions/services/embeddings/*.ts
139
- */
140
- export function defineEmbedding(config) {
141
- return config;
142
- }
143
- /**
144
- * Stub for definePage - returns the page definition
145
- * Used in features/{feature}/pages/*.ts
146
- */
147
- export function definePage(config) {
148
- return config;
149
- }
150
85
  /**
151
86
  * Stub for ActionError — mirrors the runtime class the compiler emits into
152
87
  * src/lib/types.ts so user files importing it from "@quickback/compiler"
@@ -1 +1 @@
1
- {"version":3,"file":"compiler-stubs.js","sourceRoot":"","sources":["../../src/lib/compiler-stubs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAA+B;IAC1D,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,MAAgC;IAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,EAAE,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,MAAgC;IAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,EAAE,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,MAAgC;IACvE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,EAAE,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,MAAgC;IAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,EAAE,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY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CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,CAAC,MAA+B,EAAE,EAAE,CAAC,MAAM,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,IAAI,CAAS;IACb,UAAU,CAAS;IACnB,OAAO,CAA2B;IAE3C,YACE,OAAe,EACf,IAAY,EACZ,aAAqB,GAAG,EACxB,OAAiC;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,43 @@
1
+ export interface PassthroughOptions {
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 PassthroughResult {
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
+ }
17
+ export interface PassthroughCollision {
18
+ /** Source path relative to `quickback/<dirName>/`, POSIX-normalized. */
19
+ relPath: string;
20
+ /** Compiler-manifest path it would overwrite, POSIX-normalized. */
21
+ manifestPath: string;
22
+ }
23
+ export interface PassthroughSpec {
24
+ /** Folder under `quickback/`, e.g. `public` or `apps`. */
25
+ dirName: string;
26
+ /** Subdirectory names to prune during the walk. */
27
+ skipDirs?: ReadonlySet<string>;
28
+ /** Builds the error thrown when any file would shadow compiler output. */
29
+ collisionError: (collisions: PassthroughCollision[]) => Error;
30
+ }
31
+ /**
32
+ * Shared message body for the passthrough collision errors, so both read
33
+ * identically apart from the folder they name.
34
+ */
35
+ export declare function collisionMessage(dirName: string, collisions: PassthroughCollision[]): string;
36
+ /**
37
+ * Copy `<projectRoot>/quickback/<dirName>/**` into `<outputDir>/src/apps/**`.
38
+ *
39
+ * Returns `{ copied: 0 }` when the source folder is absent — both folders are
40
+ * opt-in conventions, not required directories.
41
+ */
42
+ export declare function copyPassthrough(spec: PassthroughSpec, options: PassthroughOptions): Promise<PassthroughResult>;
43
+ //# sourceMappingURL=copy-passthrough.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-passthrough.d.ts","sourceRoot":"","sources":["../../src/lib/copy-passthrough.ts"],"names":[],"mappings":"AA2BA,MAAM,WAAW,kBAAkB;IACjC,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,iBAAiB;IAChC,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC/B,0EAA0E;IAC1E,cAAc,EAAE,CAAC,UAAU,EAAE,oBAAoB,EAAE,KAAK,KAAK,CAAC;CAC/D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAQ5F;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,CAoC5B"}
@@ -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,EA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EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;YACnB,CAAC;iBAAM,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;gBAC1B,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,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,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;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAgC;IAEhC,OAAO,eAAe,CACpB;QACE,OAAO,EAAE,eAAe;QACxB,cAAc,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,yBAAyB,CAAC,UAAU,CAAC;KAC1E,EACD,OAAO,CACR,CAAC;AACJ,CAAC"}
@@ -1,28 +1,30 @@
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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