create-nifra 3.5.0 → 4.0.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.
- package/README.md +3 -3
- package/dist/agent-files.d.ts +41 -26
- package/dist/agent-files.d.ts.map +1 -1
- package/dist/agent-files.js +80 -47
- package/dist/agent-files.js.map +1 -1
- package/dist/agents.d.ts +3 -3
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +65 -69
- package/dist/agents.js.map +1 -1
- package/dist/auth.d.ts +5 -4
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +27 -14
- package/dist/auth.js.map +1 -1
- package/dist/cli.d.ts +23 -25
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +141 -130
- package/dist/cli.js.map +1 -1
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +49 -48
- package/dist/db.js.map +1 -1
- package/dist/scaffold/frameworks.d.ts +13 -38
- package/dist/scaffold/frameworks.d.ts.map +1 -1
- package/dist/scaffold/frameworks.js +9 -32
- package/dist/scaffold/frameworks.js.map +1 -1
- package/dist/scaffold/route-types.d.ts +9 -0
- package/dist/scaffold/route-types.d.ts.map +1 -0
- package/dist/scaffold/route-types.js +61 -0
- package/dist/scaffold/route-types.js.map +1 -0
- package/dist/scaffold/site-files.d.ts +14 -8
- package/dist/scaffold/site-files.d.ts.map +1 -1
- package/dist/scaffold/site-files.js +29 -60
- package/dist/scaffold/site-files.js.map +1 -1
- package/dist/scaffold/site.d.ts +8 -5
- package/dist/scaffold/site.d.ts.map +1 -1
- package/dist/scaffold/site.js +47 -34
- package/dist/scaffold/site.js.map +1 -1
- package/dist/scaffold/targets.d.ts +39 -0
- package/dist/scaffold/targets.d.ts.map +1 -0
- package/dist/scaffold/targets.js +116 -0
- package/dist/scaffold/targets.js.map +1 -0
- package/package.json +4 -1
- package/src/agent-files.ts +89 -47
- package/template/README.md +12 -6
- package/template/{src → backend}/app.test.ts +2 -2
- package/template/{src → backend}/app.ts +8 -3
- package/template/{src → backend}/index.ts +2 -2
- package/template/{src → backend}/routes.ts +1 -1
- package/template/nifra.assurance.ts +16 -14
- package/template/package.json +7 -7
- package/template/tsconfig.json +1 -1
- package/template-batteries/README.md +10 -6
- package/template-batteries/{src → backend}/app.test.ts +23 -23
- package/template-batteries/{src → backend}/app.ts +8 -3
- package/template-batteries/{src → backend}/index.ts +2 -2
- package/template-batteries/{src → backend}/notes.ts +1 -1
- package/template-batteries/nifra.assurance.ts +16 -14
- package/template-batteries/package.json +10 -9
- package/template-batteries/tsconfig.json +1 -1
- package/template-isr/README.md +3 -0
- package/template-isr/{backend.ts → backend/app.ts} +2 -0
- package/template-isr/{server.ts → backend/dev-server.ts} +4 -4
- package/template-isr/{worker.ts → backend/worker.ts} +4 -2
- package/template-isr/build.ts +3 -1
- package/template-isr/gitignore +7 -1
- package/template-isr/nifra.assurance.ts +15 -13
- package/template-isr/package.json +10 -9
- package/template-isr/routes/index.backend.ts +14 -0
- package/template-isr/routes/index.tsx +5 -17
- package/template-isr/tsconfig.json +5 -4
- package/template-isr/wrangler.toml +6 -1
- package/template-site/README.md +24 -23
- package/template-site/{backend.ts → backend/app.ts} +6 -4
- package/template-site/gitignore +5 -10
- package/template-site/nifra.assurance.ts +15 -13
- package/template-site/nifra.config.ts +4 -4
- package/template-site/routes/index.backend.ts +18 -0
- package/template-site/routes/index.tsx +2 -15
- package/template-site-preact/README.md +21 -20
- package/template-site-preact/nifra.config.ts +4 -4
- package/template-site-preact/routes/_layout.tsx +3 -1
- package/template-site-preact/routes/index.tsx +2 -15
- package/template-site-solid/README.md +21 -19
- package/template-site-solid/nifra.config.ts +5 -4
- package/template-site-solid/routes/index.tsx +2 -15
- package/template-site-svelte/README.md +21 -19
- package/template-site-svelte/nifra.config.ts +3 -2
- package/template-site-svelte/routes/index.svelte +3 -16
- package/template-site-vue/README.md +21 -20
- package/template-site-vue/nifra.config.ts +4 -3
- package/template-site-vue/routes/_layout.vue +21 -25
- package/template-site-vue/routes/index.vue +12 -18
- package/dist/scaffold/site-build.d.ts +0 -60
- package/dist/scaffold/site-build.d.ts.map +0 -1
- package/dist/scaffold/site-build.js +0 -198
- package/dist/scaffold/site-build.js.map +0 -1
- package/template-site/.dockerignore +0 -14
- package/template-site/Dockerfile +0 -25
- package/template-site/_worker.ts +0 -17
- package/template-site/deno.json +0 -7
- package/template-site/server-bun.ts +0 -35
- package/template-site/server-deno.ts +0 -38
- package/template-site/server-node.ts +0 -40
- package/template-site/server-vercel.ts +0 -17
- package/template-site/wrangler.toml +0 -4
- /package/template-isr/{page.ts → backend/page.ts} +0 -0
- /package/template-site/{counter.ts → backend/counter.ts} +0 -0
package/dist/db.js
CHANGED
|
@@ -81,11 +81,12 @@ export type NewNote = typeof notes.$inferInsert
|
|
|
81
81
|
// it, and routes import whichever one they need - which is what lets a GET route declare \`db.read\`
|
|
82
82
|
// and nothing else. See the header those files carry for why the split is load-bearing.
|
|
83
83
|
const WIRE_DOC = `// The connection. Route modules do NOT import this file: they import \`./read.ts\` or \`./write.ts\`, so
|
|
84
|
-
// what a route can reach matches what it declares. \`
|
|
85
|
-
// is one line:
|
|
86
|
-
// import { notesRead } from "
|
|
87
|
-
// export const
|
|
88
|
-
//
|
|
84
|
+
// what a route can reach matches what it declares. \`read-routes.ts\` shows the shape, and merging it
|
|
85
|
+
// into \`backend/app.ts\` is one line:
|
|
86
|
+
// import { notesRead } from "./db/read-routes.ts"
|
|
87
|
+
// export const backend = server().merge(notesRead)
|
|
88
|
+
// A frontend file (routes/x.tsx, frontend/) can never import this - the build refuses it. Reach it
|
|
89
|
+
// from a route's x.backend.ts loader through ctx.api.`;
|
|
89
90
|
/**
|
|
90
91
|
* Why the seam is split by access rather than exported as one `db`.
|
|
91
92
|
*
|
|
@@ -95,7 +96,7 @@ const WIRE_DOC = `// The connection. Route modules do NOT import this file: they
|
|
|
95
96
|
* has to be moved. Splitting reads from writes at the seam, and again at the routes, is what keeps
|
|
96
97
|
* every route's reach equal to what it says about itself.
|
|
97
98
|
*
|
|
98
|
-
* The same shape is what makes the policy in `nifra.assurance.ts` bite: `db/write.ts` grants
|
|
99
|
+
* The same shape is what makes the policy in `nifra.assurance.ts` bite: `backend/db/write.ts` grants
|
|
99
100
|
* `db.write`, the `authenticated-write` rule demands authentication of anything holding it, and a POST
|
|
100
101
|
* that skips auth fails the check rather than shipping.
|
|
101
102
|
*/
|
|
@@ -197,8 +198,8 @@ export * from "./schema.ts"
|
|
|
197
198
|
const PG_CONFIG = `import { defineConfig } from "drizzle-kit"
|
|
198
199
|
|
|
199
200
|
export default defineConfig({
|
|
200
|
-
schema: "./db/schema.ts",
|
|
201
|
-
out: "./db/migrations",
|
|
201
|
+
schema: "./backend/db/schema.ts",
|
|
202
|
+
out: "./backend/db/migrations",
|
|
202
203
|
dialect: "postgresql",
|
|
203
204
|
// biome-ignore lint/style/noNonNullAssertion: drizzle-kit reads this from .env (Bun auto-loads it).
|
|
204
205
|
dbCredentials: { url: process.env.DATABASE_URL! },
|
|
@@ -207,8 +208,8 @@ export default defineConfig({
|
|
|
207
208
|
const SQLITE_CONFIG = `import { defineConfig } from "drizzle-kit"
|
|
208
209
|
|
|
209
210
|
export default defineConfig({
|
|
210
|
-
schema: "./db/schema.ts",
|
|
211
|
-
out: "./db/migrations",
|
|
211
|
+
schema: "./backend/db/schema.ts",
|
|
212
|
+
out: "./backend/db/migrations",
|
|
212
213
|
dialect: "sqlite",
|
|
213
214
|
dbCredentials: { url: process.env.DATABASE_URL ?? "local.db" },
|
|
214
215
|
})
|
|
@@ -216,8 +217,8 @@ export default defineConfig({
|
|
|
216
217
|
const LIBSQL_CONFIG = `import { defineConfig } from "drizzle-kit"
|
|
217
218
|
|
|
218
219
|
export default defineConfig({
|
|
219
|
-
schema: "./db/schema.ts",
|
|
220
|
-
out: "./db/migrations",
|
|
220
|
+
schema: "./backend/db/schema.ts",
|
|
221
|
+
out: "./backend/db/migrations",
|
|
221
222
|
dialect: "turso",
|
|
222
223
|
dbCredentials: {
|
|
223
224
|
url: process.env.DATABASE_URL ?? "file:local.db",
|
|
@@ -322,16 +323,16 @@ const PRISMA_SQLITE_ENV = `# Local SQLite file (Prisma). Never commit the real .
|
|
|
322
323
|
DATABASE_URL="file:./local.db"
|
|
323
324
|
`;
|
|
324
325
|
// --- Kysely preset ----------------------------------------------------------------------------------
|
|
325
|
-
// Kysely is a typed query builder, not an ORM: you describe the DB shape (db/schema.ts) and own the
|
|
326
|
-
// migrations. It ships no CLI, so the scaffold includes a Migrator runner (db/migrate.ts) + a starter
|
|
326
|
+
// Kysely is a typed query builder, not an ORM: you describe the DB shape (backend/db/schema.ts) and own the
|
|
327
|
+
// migrations. It ships no CLI, so the scaffold includes a Migrator runner (backend/db/migrate.ts) + a starter
|
|
327
328
|
// migration. Postgres via the official PostgresDialect + node-postgres.
|
|
328
329
|
const KYSELY_VERSION = "^0.27.4";
|
|
329
330
|
const KYSELY_SCRIPTS = {
|
|
330
|
-
"db:migrate": "bun run db/migrate.ts",
|
|
331
|
+
"db:migrate": "bun run backend/db/migrate.ts",
|
|
331
332
|
};
|
|
332
333
|
const KYSELY_PG_SCHEMA = `import type { ColumnType, Generated } from "kysely"
|
|
333
334
|
|
|
334
|
-
// Kysely is types-only: describe the DB shape and keep it in sync with db/migrations (or generate it
|
|
335
|
+
// Kysely is types-only: describe the DB shape and keep it in sync with backend/db/migrations (or generate it
|
|
335
336
|
// with \`kysely-codegen\`). There is no runtime schema object.
|
|
336
337
|
export interface NotesTable {
|
|
337
338
|
id: Generated<string> // uuid PK, DB-defaulted (gen_random_uuid())
|
|
@@ -403,7 +404,7 @@ import { FileMigrationProvider, Migrator } from "kysely"
|
|
|
403
404
|
import { db } from "./index.ts"
|
|
404
405
|
|
|
405
406
|
// Kysely ships no migration CLI, so this is the runner: it applies every pending migration in
|
|
406
|
-
// db/migrations (in filename order, each in its own transaction). Run with \`bun run db:migrate\`.
|
|
407
|
+
// backend/db/migrations (in filename order, each in its own transaction). Run with \`bun run db:migrate\`.
|
|
407
408
|
const migrator = new Migrator({
|
|
408
409
|
db,
|
|
409
410
|
provider: new FileMigrationProvider({
|
|
@@ -433,11 +434,11 @@ export const DB_PRESETS = {
|
|
|
433
434
|
devDeps: { "drizzle-kit": DRIZZLE_KIT },
|
|
434
435
|
scripts: SCRIPTS,
|
|
435
436
|
files: {
|
|
436
|
-
"db/schema.ts": SQLITE_SCHEMA,
|
|
437
|
-
"db/index.ts": LIBSQL_CLIENT,
|
|
438
|
-
"db/read.ts": DRIZZLE_READ,
|
|
439
|
-
"db/write.ts": DRIZZLE_WRITE,
|
|
440
|
-
"db/read-routes.ts": READ_ROUTES,
|
|
437
|
+
"backend/db/schema.ts": SQLITE_SCHEMA,
|
|
438
|
+
"backend/db/index.ts": LIBSQL_CLIENT,
|
|
439
|
+
"backend/db/read.ts": DRIZZLE_READ,
|
|
440
|
+
"backend/db/write.ts": DRIZZLE_WRITE,
|
|
441
|
+
"backend/db/read-routes.ts": READ_ROUTES,
|
|
441
442
|
"drizzle.config.ts": LIBSQL_CONFIG,
|
|
442
443
|
".env.example": LIBSQL_ENV,
|
|
443
444
|
},
|
|
@@ -451,11 +452,11 @@ export const DB_PRESETS = {
|
|
|
451
452
|
devDeps: { "drizzle-kit": DRIZZLE_KIT },
|
|
452
453
|
scripts: SCRIPTS,
|
|
453
454
|
files: {
|
|
454
|
-
"db/schema.ts": PG_SCHEMA,
|
|
455
|
-
"db/index.ts": PG_CLIENT,
|
|
456
|
-
"db/read.ts": DRIZZLE_READ,
|
|
457
|
-
"db/write.ts": DRIZZLE_WRITE,
|
|
458
|
-
"db/read-routes.ts": READ_ROUTES,
|
|
455
|
+
"backend/db/schema.ts": PG_SCHEMA,
|
|
456
|
+
"backend/db/index.ts": PG_CLIENT,
|
|
457
|
+
"backend/db/read.ts": DRIZZLE_READ,
|
|
458
|
+
"backend/db/write.ts": DRIZZLE_WRITE,
|
|
459
|
+
"backend/db/read-routes.ts": READ_ROUTES,
|
|
459
460
|
"drizzle.config.ts": PG_CONFIG,
|
|
460
461
|
".env.example": PG_ENV,
|
|
461
462
|
},
|
|
@@ -469,11 +470,11 @@ export const DB_PRESETS = {
|
|
|
469
470
|
devDeps: { "drizzle-kit": DRIZZLE_KIT },
|
|
470
471
|
scripts: SCRIPTS,
|
|
471
472
|
files: {
|
|
472
|
-
"db/schema.ts": SQLITE_SCHEMA,
|
|
473
|
-
"db/index.ts": SQLITE_CLIENT,
|
|
474
|
-
"db/read.ts": DRIZZLE_READ,
|
|
475
|
-
"db/write.ts": DRIZZLE_WRITE,
|
|
476
|
-
"db/read-routes.ts": READ_ROUTES,
|
|
473
|
+
"backend/db/schema.ts": SQLITE_SCHEMA,
|
|
474
|
+
"backend/db/index.ts": SQLITE_CLIENT,
|
|
475
|
+
"backend/db/read.ts": DRIZZLE_READ,
|
|
476
|
+
"backend/db/write.ts": DRIZZLE_WRITE,
|
|
477
|
+
"backend/db/read-routes.ts": READ_ROUTES,
|
|
477
478
|
"drizzle.config.ts": SQLITE_CONFIG,
|
|
478
479
|
".env.example": SQLITE_ENV,
|
|
479
480
|
},
|
|
@@ -488,10 +489,10 @@ export const DB_PRESETS = {
|
|
|
488
489
|
scripts: PRISMA_SCRIPTS,
|
|
489
490
|
files: {
|
|
490
491
|
"prisma/schema.prisma": PRISMA_PG_SCHEMA,
|
|
491
|
-
"db/index.ts": PRISMA_CLIENT,
|
|
492
|
-
"db/read.ts": PRISMA_READ,
|
|
493
|
-
"db/write.ts": PRISMA_WRITE,
|
|
494
|
-
"db/read-routes.ts": READ_ROUTES,
|
|
492
|
+
"backend/db/index.ts": PRISMA_CLIENT,
|
|
493
|
+
"backend/db/read.ts": PRISMA_READ,
|
|
494
|
+
"backend/db/write.ts": PRISMA_WRITE,
|
|
495
|
+
"backend/db/read-routes.ts": READ_ROUTES,
|
|
495
496
|
".env.example": PRISMA_PG_ENV,
|
|
496
497
|
},
|
|
497
498
|
},
|
|
@@ -505,10 +506,10 @@ export const DB_PRESETS = {
|
|
|
505
506
|
scripts: PRISMA_SCRIPTS,
|
|
506
507
|
files: {
|
|
507
508
|
"prisma/schema.prisma": PRISMA_SQLITE_SCHEMA,
|
|
508
|
-
"db/index.ts": PRISMA_CLIENT,
|
|
509
|
-
"db/read.ts": PRISMA_READ,
|
|
510
|
-
"db/write.ts": PRISMA_WRITE,
|
|
511
|
-
"db/read-routes.ts": READ_ROUTES,
|
|
509
|
+
"backend/db/index.ts": PRISMA_CLIENT,
|
|
510
|
+
"backend/db/read.ts": PRISMA_READ,
|
|
511
|
+
"backend/db/write.ts": PRISMA_WRITE,
|
|
512
|
+
"backend/db/read-routes.ts": READ_ROUTES,
|
|
512
513
|
".env.example": PRISMA_SQLITE_ENV,
|
|
513
514
|
},
|
|
514
515
|
},
|
|
@@ -521,13 +522,13 @@ export const DB_PRESETS = {
|
|
|
521
522
|
devDeps: { "@types/pg": "^8.11.10" },
|
|
522
523
|
scripts: KYSELY_SCRIPTS,
|
|
523
524
|
files: {
|
|
524
|
-
"db/schema.ts": KYSELY_PG_SCHEMA,
|
|
525
|
-
"db/index.ts": KYSELY_PG_CLIENT,
|
|
526
|
-
"db/read.ts": KYSELY_READ,
|
|
527
|
-
"db/write.ts": KYSELY_WRITE,
|
|
528
|
-
"db/read-routes.ts": READ_ROUTES,
|
|
529
|
-
"db/migrate.ts": KYSELY_MIGRATE_RUNNER,
|
|
530
|
-
"db/migrations/0001_create_notes.ts": KYSELY_MIGRATION,
|
|
525
|
+
"backend/db/schema.ts": KYSELY_PG_SCHEMA,
|
|
526
|
+
"backend/db/index.ts": KYSELY_PG_CLIENT,
|
|
527
|
+
"backend/db/read.ts": KYSELY_READ,
|
|
528
|
+
"backend/db/write.ts": KYSELY_WRITE,
|
|
529
|
+
"backend/db/read-routes.ts": READ_ROUTES,
|
|
530
|
+
"backend/db/migrate.ts": KYSELY_MIGRATE_RUNNER,
|
|
531
|
+
"backend/db/migrations/0001_create_notes.ts": KYSELY_MIGRATION,
|
|
531
532
|
".env.example": PG_ENV,
|
|
532
533
|
},
|
|
533
534
|
},
|
|
@@ -538,7 +539,7 @@ const GITIGNORE_BLOCK = `
|
|
|
538
539
|
local.db
|
|
539
540
|
*.db-shm
|
|
540
541
|
*.db-wal
|
|
541
|
-
db/migrations/meta
|
|
542
|
+
backend/db/migrations/meta
|
|
542
543
|
`;
|
|
543
544
|
/** Write a DB preset's files into `target` and ensure local DB artifacts + .env are gitignored. */
|
|
544
545
|
export async function writeDbFiles(target, choice) {
|
package/dist/db.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.js","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEzC,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,gBAAgB;IAChB,kBAAkB;IAClB,gBAAgB;IAChB,iBAAiB;IACjB,eAAe;IACf,iBAAiB;CACT,CAAA;AAsBV,MAAM,WAAW,GAAG,SAAS,CAAA;AAC7B,MAAM,WAAW,GAAG,SAAS,CAAA;AAC7B,MAAM,OAAO,GAAqC;IAChD,aAAa,EAAE,sBAAsB;IACrC,YAAY,EAAE,qBAAqB;IACnC,WAAW,EAAE,oBAAoB;CAClC,CAAA;AAED,uGAAuG;AAEvG,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;CAiBjB,CAAA;AAED,sGAAsG;AACtG,gGAAgG;AAChG,iGAAiG;AACjG,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBrB,CAAA;AAED,wGAAwG;AACxG,6FAA6F;AAE7F,yGAAyG;AACzG,qGAAqG;AACrG,wFAAwF;AACxF,MAAM,QAAQ,GAAG
|
|
1
|
+
{"version":3,"file":"db.js","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAAA;;;;;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C,IAAI,EAAE,OAAO,CAAC,CAAA;IAChC,CAAC;IACD,mGAAmG;IACnG,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAChD,IAAI,OAAO,GAAG,EAAE,CAAA;IAChB,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,sEAAsE;IACxE,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAClC,MAAM,SAAS,CAAC,aAAa,EAAE,GAAG,OAAO,GAAG,eAAe,EAAE,CAAC,CAAA;IAChE,CAAC;AACH,CAAC"}
|
|
@@ -1,57 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What a frontend framework contributes to a site scaffold.
|
|
3
3
|
*
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* So the runtime knowledge lives once (see `site.ts`), and a framework contributes only what is
|
|
10
|
-
* genuinely its own: an adapter, a bundler plugin, the resolve conditions and defines its compiler
|
|
11
|
-
* needs, and its dependency set. The prose a framework needs to explain ITSELF - why Solid wants a
|
|
12
|
-
* `"solid"` resolve condition, what `@preact/preset-vite` is - stays in a real file next to it. That
|
|
13
|
-
* is the line: mechanical differences are modelled, explanations are written.
|
|
4
|
+
* The runtime knowledge lives once (see `site.ts`), and a framework contributes only what is genuinely
|
|
5
|
+
* its own: an adapter, its dependency set and its tsconfig needs. The bundler plugin, resolve conditions
|
|
6
|
+
* and defines its compiler needs live in its `nifra.config.ts`, with the prose that explains them - why
|
|
7
|
+
* Solid wants a `"solid"` resolve condition, what `@preact/preset-vite` is. That is the line: mechanical
|
|
8
|
+
* differences are modelled, explanations are written.
|
|
14
9
|
*/
|
|
15
|
-
/** A `plugins: [x("dom")]` entry the framework's compiler needs in a Bun build. */
|
|
16
|
-
export interface BunPluginSpec {
|
|
17
|
-
/** Module the plugin factory is imported from. */
|
|
18
|
-
readonly specifier: string;
|
|
19
|
-
/** The factory's exported name. */
|
|
20
|
-
readonly name: string;
|
|
21
|
-
/** Trailing comment on the call, when the framework has something to say about it. */
|
|
22
|
-
readonly note?: {
|
|
23
|
-
readonly dom: string;
|
|
24
|
-
readonly ssr: string;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
10
|
export interface FrameworkSpec {
|
|
28
11
|
readonly id: string;
|
|
29
12
|
/** The adapter export, e.g. `reactAdapter`. */
|
|
30
13
|
readonly adapter: string;
|
|
31
14
|
/** The adapter's package, e.g. `@nifrajs/web-react`. */
|
|
32
15
|
readonly package: string;
|
|
33
|
-
/** Compiler plugin for `.vue`/`.svelte`/Solid JSX. Absent for the JSX-native frameworks. */
|
|
34
|
-
readonly bunPlugin?: BunPluginSpec;
|
|
35
|
-
/** Resolve conditions this framework adds beyond the runtime's own. */
|
|
36
|
-
readonly conditions?: {
|
|
37
|
-
readonly client?: readonly string[];
|
|
38
|
-
readonly ssr?: readonly string[];
|
|
39
|
-
};
|
|
40
|
-
/** Build-time defines beyond `process.env.NODE_ENV`, in emission order. */
|
|
41
|
-
readonly define?: Readonly<Record<string, string>>;
|
|
42
|
-
/** Comment above the hoisted `define`, when the framework's flags need explaining. */
|
|
43
|
-
readonly defineNote?: string;
|
|
44
16
|
/** Runtime dependencies beyond the shared Nifra set, in emission order. */
|
|
45
17
|
readonly runtimeDependencies: Readonly<Record<string, string>>;
|
|
46
|
-
/** Dev dependencies beyond `@nifrajs/cli`, `typescript` and `vite`, in emission order. */
|
|
18
|
+
/** Dev dependencies beyond `@nifrajs/cli`, `@types/bun`, `typescript` and `vite`, in emission order. */
|
|
47
19
|
readonly devDependencies: Readonly<Record<string, string>>;
|
|
48
20
|
/** What this framework needs from `tsconfig.json`. */
|
|
49
21
|
readonly typescript: {
|
|
50
22
|
readonly jsx?: string;
|
|
51
23
|
readonly jsxImportSource?: string;
|
|
52
24
|
readonly types?: readonly string[];
|
|
53
|
-
/**
|
|
54
|
-
|
|
25
|
+
/**
|
|
26
|
+
* The tsconfig `include` globs, when not `.ts` + `.tsx`. A framework whose routes are its own
|
|
27
|
+
* component files lists them, or svelte-check, vue-tsc and the editor never type-check a route.
|
|
28
|
+
*/
|
|
29
|
+
readonly include?: readonly string[];
|
|
55
30
|
};
|
|
56
31
|
}
|
|
57
32
|
/**
|
|
@@ -59,10 +34,10 @@ export interface FrameworkSpec {
|
|
|
59
34
|
*
|
|
60
35
|
* One constant, because it used to be a regex sweep over eight `package.json` files in the release
|
|
61
36
|
* script with nothing checking the result - and the script's own comment warns that a missed bump
|
|
62
|
-
* ships templates installing the PREVIOUS release. `scaffold-
|
|
37
|
+
* ships templates installing the PREVIOUS release. `scaffold-composition.test.ts` now fails when this
|
|
63
38
|
* drifts from what core is publishing, so the footgun is a red test rather than a silent regression.
|
|
64
39
|
*/
|
|
65
|
-
export declare const NIFRA_DEP_RANGE = "^
|
|
40
|
+
export declare const NIFRA_DEP_RANGE = "^4.0.2";
|
|
66
41
|
/**
|
|
67
42
|
* React is first because it is the default (`--framework` omitted scaffolds it), and because the
|
|
68
43
|
* other four are most easily read as deltas from it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frameworks.d.ts","sourceRoot":"","sources":["../../src/scaffold/frameworks.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"frameworks.d.ts","sourceRoot":"","sources":["../../src/scaffold/frameworks.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,2EAA2E;IAC3E,QAAQ,CAAC,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC9D,wGAAwG;IACxG,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC1D,sDAAsD;IACtD,QAAQ,CAAC,UAAU,EAAE;QACnB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAA;QACjC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;QAClC;;;WAGG;QACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KACrC,CAAA;CACF;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,WAAW,CAAA;AAEvC;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CA4CnE,CAAA;AAED,eAAO,MAAM,aAAa,UAA+B,CAAA;AAEzD,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,CAMvD"}
|
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What a frontend framework contributes to a site scaffold.
|
|
3
3
|
*
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* So the runtime knowledge lives once (see `site.ts`), and a framework contributes only what is
|
|
10
|
-
* genuinely its own: an adapter, a bundler plugin, the resolve conditions and defines its compiler
|
|
11
|
-
* needs, and its dependency set. The prose a framework needs to explain ITSELF - why Solid wants a
|
|
12
|
-
* `"solid"` resolve condition, what `@preact/preset-vite` is - stays in a real file next to it. That
|
|
13
|
-
* is the line: mechanical differences are modelled, explanations are written.
|
|
4
|
+
* The runtime knowledge lives once (see `site.ts`), and a framework contributes only what is genuinely
|
|
5
|
+
* its own: an adapter, its dependency set and its tsconfig needs. The bundler plugin, resolve conditions
|
|
6
|
+
* and defines its compiler needs live in its `nifra.config.ts`, with the prose that explains them - why
|
|
7
|
+
* Solid wants a `"solid"` resolve condition, what `@preact/preset-vite` is. That is the line: mechanical
|
|
8
|
+
* differences are modelled, explanations are written.
|
|
14
9
|
*/
|
|
15
10
|
/**
|
|
16
11
|
* The `@nifrajs/*` range a scaffolded site installs.
|
|
17
12
|
*
|
|
18
13
|
* One constant, because it used to be a regex sweep over eight `package.json` files in the release
|
|
19
14
|
* script with nothing checking the result - and the script's own comment warns that a missed bump
|
|
20
|
-
* ships templates installing the PREVIOUS release. `scaffold-
|
|
15
|
+
* ships templates installing the PREVIOUS release. `scaffold-composition.test.ts` now fails when this
|
|
21
16
|
* drifts from what core is publishing, so the footgun is a red test rather than a silent regression.
|
|
22
17
|
*/
|
|
23
|
-
export const NIFRA_DEP_RANGE = "^
|
|
18
|
+
export const NIFRA_DEP_RANGE = "^4.0.2";
|
|
24
19
|
/**
|
|
25
20
|
* React is first because it is the default (`--framework` omitted scaffolds it), and because the
|
|
26
21
|
* other four are most easily read as deltas from it.
|
|
@@ -52,10 +47,6 @@ export const FRAMEWORK_SPECS = {
|
|
|
52
47
|
runtimeDependencies: { "solid-js": "^1.9.0" },
|
|
53
48
|
devDependencies: { "vite-plugin-solid": "^2.10.0" },
|
|
54
49
|
typescript: { jsx: "preserve", jsxImportSource: "solid-js" },
|
|
55
|
-
bunPlugin: { specifier: "@nifrajs/web-solid", name: "solidBunPlugin" },
|
|
56
|
-
// Solid publishes a `solid` export condition that routes `solid-js` to its JSX source; without it
|
|
57
|
-
// the bundler takes the pre-compiled build and hydration has nothing to attach to.
|
|
58
|
-
conditions: { client: ["solid"], ssr: ["solid"] },
|
|
59
50
|
},
|
|
60
51
|
svelte: {
|
|
61
52
|
id: "svelte",
|
|
@@ -63,8 +54,7 @@ export const FRAMEWORK_SPECS = {
|
|
|
63
54
|
package: "@nifrajs/web-svelte",
|
|
64
55
|
runtimeDependencies: { svelte: "^5.3.0" },
|
|
65
56
|
devDependencies: { "@sveltejs/vite-plugin-svelte": "^5.0.0" },
|
|
66
|
-
typescript: { types: ["svelte"],
|
|
67
|
-
bunPlugin: { specifier: "@nifrajs/web-svelte/plugin", name: "svelteBunPlugin" },
|
|
57
|
+
typescript: { types: ["svelte"], include: ["**/*.ts", "**/*.svelte"] },
|
|
68
58
|
},
|
|
69
59
|
vue: {
|
|
70
60
|
id: "vue",
|
|
@@ -72,20 +62,7 @@ export const FRAMEWORK_SPECS = {
|
|
|
72
62
|
package: "@nifrajs/web-vue",
|
|
73
63
|
runtimeDependencies: { vue: "^3.5.0" },
|
|
74
64
|
devDependencies: { "@vitejs/plugin-vue": "^5.2.0", "@vue/compiler-sfc": "^3.5.0" },
|
|
75
|
-
typescript: { jsx: "preserve" },
|
|
76
|
-
bunPlugin: {
|
|
77
|
-
specifier: "@nifrajs/web-vue/plugin",
|
|
78
|
-
name: "vueBunPlugin",
|
|
79
|
-
note: { dom: " // compile .vue SFCs → client bundle", ssr: " // compile .vue SFCs → SSR" },
|
|
80
|
-
},
|
|
81
|
-
// Vue reads these at build time to drop dev-only branches; leaving them undefined ships the
|
|
82
|
-
// development runtime and warns about it on every boot.
|
|
83
|
-
defineNote: '// Vue feature flags: silence "feature flag not explicitly defined" warnings + trim dev-only code.',
|
|
84
|
-
define: {
|
|
85
|
-
__VUE_OPTIONS_API__: '"true"',
|
|
86
|
-
__VUE_PROD_DEVTOOLS__: '"false"',
|
|
87
|
-
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: '"false"',
|
|
88
|
-
},
|
|
65
|
+
typescript: { jsx: "preserve", include: ["**/*.ts", "**/*.tsx", "**/*.vue"] },
|
|
89
66
|
},
|
|
90
67
|
};
|
|
91
68
|
export const FRAMEWORK_IDS = Object.keys(FRAMEWORK_SPECS);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frameworks.js","sourceRoot":"","sources":["../../src/scaffold/frameworks.ts"],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EAAE,QAAQ,EAAE;QACzC,eAAe,EAAE,EAAE,8BAA8B,EAAE,QAAQ,EAAE;QAC7D,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC,EAAE;KACvE;IACD,GAAG,EAAE;QACH,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,kBAAkB;QAC3B,mBAAmB,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE;QACtC,eAAe,EAAE,EAAE,oBAAoB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,QAAQ,EAAE;QAClF,UAAU,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE;KAC9E;CACF,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;AAEzD,MAAM,UAAU,aAAa,CAAC,EAAU;IACtC,MAAM,IAAI,GAAG,eAAe,CAAC,EAAE,CAAC,CAAA;IAChC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,sBAAsB,EAAE,eAAe,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACpF,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The starter's `.nifra/types`, written with the scaffold so `import type { Route } from "./+types/index"`
|
|
3
|
+
* resolves before any nifra command has run. From the first `nifra dev|build|check|types` on, the
|
|
4
|
+
* generator in `@nifrajs/web/route-types` owns the directory; `route-types.test.ts` holds this text
|
|
5
|
+
* byte-equal to what that generator writes for every scaffold that has routes.
|
|
6
|
+
*/
|
|
7
|
+
/** Every `.nifra/types` file of a starter whose route files carry `extension`, by app-relative path. */
|
|
8
|
+
export declare function starterRouteTypes(extension: string): Map<string, string>;
|
|
9
|
+
//# sourceMappingURL=route-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-types.d.ts","sourceRoot":"","sources":["../../src/scaffold/route-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmEH,wGAAwG;AACxG,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAuBxE"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The starter's `.nifra/types`, written with the scaffold so `import type { Route } from "./+types/index"`
|
|
3
|
+
* resolves before any nifra command has run. From the first `nifra dev|build|check|types` on, the
|
|
4
|
+
* generator in `@nifrajs/web/route-types` owns the directory; `route-types.test.ts` holds this text
|
|
5
|
+
* byte-equal to what that generator writes for every scaffold that has routes.
|
|
6
|
+
*/
|
|
7
|
+
/** The starter's route files: `[name, kind, has a backend half]`. */
|
|
8
|
+
const STARTER_ROUTES = [
|
|
9
|
+
["_404", "page", false],
|
|
10
|
+
["_layout", "layout", false],
|
|
11
|
+
["index", "page", true],
|
|
12
|
+
];
|
|
13
|
+
const header = (label) => `// Generated by nifra from ${label}. Do not edit: \`nifra types\` rewrites it.`;
|
|
14
|
+
function routeModule(name, extension, kind, hasBackend) {
|
|
15
|
+
// Only a script module's exports are visible to TypeScript; a .svelte/.vue one is an ambient shim.
|
|
16
|
+
const script = extension === "tsx";
|
|
17
|
+
const lines = [
|
|
18
|
+
header(`routes/${name}.${extension}`),
|
|
19
|
+
'/// <reference path="../../register.d.ts" />',
|
|
20
|
+
'import type { OutputOf, RouteLoaderArgs, SearchSchemaOf } from "@nifrajs/client"',
|
|
21
|
+
];
|
|
22
|
+
if (kind === "page")
|
|
23
|
+
lines.push('import type { RenderProps } from "@nifrajs/web"');
|
|
24
|
+
lines.push("");
|
|
25
|
+
if (hasBackend)
|
|
26
|
+
lines.push(`type Backend = typeof import("../../../../routes/${name}.backend")`);
|
|
27
|
+
if (script)
|
|
28
|
+
lines.push(`type Frontend = typeof import("../../../../routes/${name}")`);
|
|
29
|
+
if (hasBackend || script)
|
|
30
|
+
lines.push("");
|
|
31
|
+
const output = (schema) => hasBackend ? `OutputOf<Backend, "${schema}">` : "null";
|
|
32
|
+
lines.push("export namespace Route {", " /** The URL params this route's path carries. */", " export type Params = Record<string, never>", " /** What the loader sends to the browser: the output type of `loaderOutput`. */", ` export type LoaderData = ${output("loaderOutput")}`, " /** What the action sends back: the output type of `actionOutput`. */", ` export type ActionData = ${output("actionOutput")}`, " /** The context the backend half's loader receives. */", ` export type LoaderArgs = RouteLoaderArgs<Params${script ? ", SearchSchemaOf<Frontend>" : ""}>`, " /** The context the backend half's action receives. */", " export type ActionArgs = LoaderArgs");
|
|
33
|
+
if (kind === "page") {
|
|
34
|
+
lines.push(" /** The page component's props. */", ' export type ComponentProps = Omit<RenderProps, "data" | "actionData" | "params"> & {', " readonly data: LoaderData", " readonly actionData?: ActionData", " readonly params: Params", " }");
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
lines.push(" /** The layout component's props; `Children` is the adapter's children type. */", " export type ComponentProps<Children = unknown> = {", " readonly data: LoaderData", " readonly children?: Children", " }");
|
|
38
|
+
}
|
|
39
|
+
lines.push("}", "");
|
|
40
|
+
return lines.join("\n");
|
|
41
|
+
}
|
|
42
|
+
/** Every `.nifra/types` file of a starter whose route files carry `extension`, by app-relative path. */
|
|
43
|
+
export function starterRouteTypes(extension) {
|
|
44
|
+
const files = new Map();
|
|
45
|
+
files.set(".nifra/types/register.d.ts", [
|
|
46
|
+
header("backend/app.ts"),
|
|
47
|
+
'import type { backend } from "../../backend/app"',
|
|
48
|
+
"",
|
|
49
|
+
'declare module "@nifrajs/client" {',
|
|
50
|
+
" interface Register {",
|
|
51
|
+
" readonly backend: typeof backend",
|
|
52
|
+
" }",
|
|
53
|
+
"}",
|
|
54
|
+
"",
|
|
55
|
+
].join("\n"));
|
|
56
|
+
for (const [name, kind, hasBackend] of STARTER_ROUTES) {
|
|
57
|
+
files.set(`.nifra/types/routes/+types/${name}.d.ts`, routeModule(name, extension, kind, hasBackend));
|
|
58
|
+
}
|
|
59
|
+
return files;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=route-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-types.js","sourceRoot":"","sources":["../../src/scaffold/route-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qEAAqE;AACrE,MAAM,cAAc,GAAG;IACrB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC;IACvB,CAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC;IAC5B,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC;CACf,CAAA;AAEV,MAAM,MAAM,GAAG,CAAC,KAAa,EAAU,EAAE,CACvC,8BAA8B,KAAK,6CAA6C,CAAA;AAElF,SAAS,WAAW,CAClB,IAAY,EACZ,SAAiB,EACjB,IAAuB,EACvB,UAAmB;IAEnB,mGAAmG;IACnG,MAAM,MAAM,GAAG,SAAS,KAAK,KAAK,CAAA;IAClC,MAAM,KAAK,GAAG;QACZ,MAAM,CAAC,UAAU,IAAI,IAAI,SAAS,EAAE,CAAC;QACrC,8CAA8C;QAC9C,kFAAkF;KACnF,CAAA;IACD,IAAI,IAAI,KAAK,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAA;IAClF,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,IAAI,UAAU;QAAE,KAAK,CAAC,IAAI,CAAC,oDAAoD,IAAI,YAAY,CAAC,CAAA;IAChG,IAAI,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,qDAAqD,IAAI,IAAI,CAAC,CAAA;IACrF,IAAI,UAAU,IAAI,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA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AE,IAAI,EAAE,UAAU,CAAC,IAAI,cAAc,EAAE,CAAC;QACtD,KAAK,CAAC,GAAG,CACP,8BAA8B,IAAI,OAAO,EACzC,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,CAAC,CAC/C,CAAA;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* which framework they name, and keeping five copies is how `.vercel` came to be excluded from four
|
|
6
|
-
* tsconfigs and not the fifth.
|
|
2
|
+
* A site scaffold's mechanical files: the adapter re-export, the manifest, the tsconfig. These were
|
|
3
|
+
* five copies each whose only real difference was which framework they name, and keeping five copies
|
|
4
|
+
* is how `.vercel` came to be excluded from four tsconfigs and not the fifth.
|
|
7
5
|
*/
|
|
8
6
|
import { type FrameworkSpec } from "./frameworks.js";
|
|
7
|
+
import { type DeployTarget } from "./targets.js";
|
|
9
8
|
/**
|
|
10
|
-
* `framework.ts` - the
|
|
11
|
-
*
|
|
9
|
+
* `backend/framework.ts` - the file the generated server entry imports the adapter from. It stays
|
|
10
|
+
* edge-bundlable: CLI-only tooling (Vite plugins, compilers) lives in `nifra.config.ts`.
|
|
12
11
|
*/
|
|
13
12
|
export declare function renderFrameworkModule(framework: FrameworkSpec): string;
|
|
14
|
-
|
|
13
|
+
/** The deploy shape a site's manifest is written for. */
|
|
14
|
+
export interface SiteTarget {
|
|
15
|
+
readonly target: DeployTarget;
|
|
16
|
+
readonly docker: boolean;
|
|
17
|
+
/** The app name, for the Docker image tag. */
|
|
18
|
+
readonly name: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function renderPackageJson(framework: FrameworkSpec, site: SiteTarget): string;
|
|
15
21
|
export declare function renderTsconfig(framework: FrameworkSpec): string;
|
|
16
22
|
//# sourceMappingURL=site-files.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-files.d.ts","sourceRoot":"","sources":["../../src/scaffold/site-files.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"site-files.d.ts","sourceRoot":"","sources":["../../src/scaffold/site-files.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,KAAK,YAAY,EAAyB,MAAM,cAAc,CAAA;AAKvE;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,aAAa,GAAG,MAAM,CAQtE;AAKD,yDAAyD;AACzD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CA+BpF;AAKD,wBAAgB,cAAc,CAAC,SAAS,EAAE,aAAa,GAAG,MAAM,CAsB/D"}
|