@c9up/ream 0.2.25 → 0.2.26

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 (78) hide show
  1. package/README.md +2 -0
  2. package/dist/Codemods.d.ts +12 -0
  3. package/dist/Codemods.d.ts.map +1 -1
  4. package/dist/Codemods.js +114 -23
  5. package/dist/Codemods.js.map +1 -1
  6. package/dist/console/Kernel.d.ts.map +1 -1
  7. package/dist/console/Kernel.js +20 -1
  8. package/dist/console/Kernel.js.map +1 -1
  9. package/dist/console/cliui.d.ts +9 -245
  10. package/dist/console/cliui.d.ts.map +1 -1
  11. package/dist/console/cliui.js +9 -583
  12. package/dist/console/cliui.js.map +1 -1
  13. package/dist/console/make/commands.d.ts +19 -0
  14. package/dist/console/make/commands.d.ts.map +1 -0
  15. package/dist/console/make/commands.js +252 -0
  16. package/dist/console/make/commands.js.map +1 -0
  17. package/dist/console/make/eject.d.ts +28 -0
  18. package/dist/console/make/eject.d.ts.map +1 -0
  19. package/dist/console/make/eject.js +161 -0
  20. package/dist/console/make/eject.js.map +1 -0
  21. package/dist/console/make/flush.d.ts +51 -0
  22. package/dist/console/make/flush.d.ts.map +1 -0
  23. package/dist/console/make/flush.js +93 -0
  24. package/dist/console/make/flush.js.map +1 -0
  25. package/dist/console/make/generators.d.ts +36 -0
  26. package/dist/console/make/generators.d.ts.map +1 -0
  27. package/dist/console/make/generators.js +148 -0
  28. package/dist/console/make/generators.js.map +1 -0
  29. package/dist/console/make/naming.d.ts +32 -0
  30. package/dist/console/make/naming.d.ts.map +1 -0
  31. package/dist/console/make/naming.js +82 -0
  32. package/dist/console/make/naming.js.map +1 -0
  33. package/dist/console/make/resolve.d.ts +46 -0
  34. package/dist/console/make/resolve.d.ts.map +1 -0
  35. package/dist/console/make/resolve.js +113 -0
  36. package/dist/console/make/resolve.js.map +1 -0
  37. package/dist/console/ui.d.ts +9 -15
  38. package/dist/console/ui.d.ts.map +1 -1
  39. package/dist/console/ui.js +11 -24
  40. package/dist/console/ui.js.map +1 -1
  41. package/dist/index.d.ts +3 -3
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +4 -2
  44. package/dist/index.js.map +1 -1
  45. package/dist/stubs/index.d.ts +11 -0
  46. package/dist/stubs/index.d.ts.map +1 -0
  47. package/dist/stubs/index.js +12 -0
  48. package/dist/stubs/index.js.map +1 -0
  49. package/dist/stubs/template.d.ts +63 -0
  50. package/dist/stubs/template.d.ts.map +1 -0
  51. package/dist/stubs/template.js +209 -0
  52. package/dist/stubs/template.js.map +1 -0
  53. package/events.win32-x64-msvc.node +0 -0
  54. package/index.win32-x64-msvc.node +0 -0
  55. package/package.json +7 -1
  56. package/scheduler.win32-x64-msvc.node +0 -0
  57. package/src/Codemods.ts +153 -29
  58. package/src/console/Kernel.ts +21 -1
  59. package/src/console/cliui.ts +44 -754
  60. package/src/console/make/commands.ts +270 -0
  61. package/src/console/make/eject.ts +163 -0
  62. package/src/console/make/flush.ts +125 -0
  63. package/src/console/make/generators.ts +176 -0
  64. package/src/console/make/naming.ts +85 -0
  65. package/src/console/make/resolve.ts +134 -0
  66. package/src/console/ui.ts +12 -24
  67. package/src/index.ts +17 -3
  68. package/src/stubs/index.ts +14 -0
  69. package/src/stubs/template.ts +262 -0
  70. package/stubs/make/command.stub +29 -0
  71. package/stubs/make/controller.stub +30 -0
  72. package/stubs/make/entity.stub +11 -0
  73. package/stubs/make/event.stub +13 -0
  74. package/stubs/make/listener.stub +13 -0
  75. package/stubs/make/middleware.stub +16 -0
  76. package/stubs/make/provider.stub +26 -0
  77. package/stubs/make/service.stub +27 -0
  78. package/stubs/make/validator.stub +10 -0
@@ -0,0 +1,176 @@
1
+ /**
2
+ * What each `make:` command generates.
3
+ *
4
+ * One table rather than ten near-identical commands: every generator is a
5
+ * name, a stub and the variables that stub reads. The differences that matter
6
+ * — which suffix a class carries, whether the name is snake_cased for the file
7
+ * — live here, in one place, instead of being spread across ten files that
8
+ * drift.
9
+ *
10
+ * The DESTINATION is not here. It is in the stub's own front matter, so an
11
+ * application that publishes `stubs/make/controller.stub` can move the file as
12
+ * well as change its contents.
13
+ */
14
+
15
+ import type { StubState } from '../../stubs/template.js'
16
+ import { ensureSuffix, stripSuffixInsensitive, toPascalCase, toSnakeCase } from './naming.js'
17
+
18
+ /** Extra input a generator takes beyond the name. */
19
+ export interface GeneratorInput {
20
+ /** `app/<module>/…` — where a module-scoped file lands. */
21
+ module?: string
22
+ /** `make:middleware --stack server|router|named`. */
23
+ stack?: string
24
+ /** `make:listener --event OrderShipped`. */
25
+ event?: string
26
+ }
27
+
28
+ export interface Generator {
29
+ /** The stub, under `stubs/make/`. */
30
+ kind: string
31
+ commandName: string
32
+ description: string
33
+ /** Does it take `--module`? */
34
+ moduleScoped: boolean
35
+ /** The variables its stub reads. */
36
+ state(name: string, input: GeneratorInput): StubState
37
+ }
38
+
39
+ /** The shared trio every stub may read. */
40
+ function base(name: string, className: string, module: string): StubState {
41
+ return { className, module, name }
42
+ }
43
+
44
+ export const GENERATORS: readonly Generator[] = [
45
+ {
46
+ kind: 'controller',
47
+ commandName: 'make:controller',
48
+ description: 'Generate an HTTP controller',
49
+ moduleScoped: true,
50
+ state: (name, input) =>
51
+ base(name, ensureSuffix(name, 'Controller'), input.module ?? 'controllers'),
52
+ },
53
+ {
54
+ kind: 'service',
55
+ commandName: 'make:service',
56
+ description: 'Generate a service class',
57
+ moduleScoped: true,
58
+ state: (name, input) => base(name, ensureSuffix(name, 'Service'), input.module ?? 'services'),
59
+ },
60
+ {
61
+ kind: 'entity',
62
+ commandName: 'make:entity',
63
+ description: 'Generate an Atlas entity',
64
+ moduleScoped: true,
65
+ state: (name, input) => ({
66
+ // No suffix: an entity is `User`, not `UserEntity`.
67
+ ...base(name, toPascalCase(name), input.module ?? 'entities'),
68
+ tableName: `${toSnakeCase(name)}s`,
69
+ }),
70
+ },
71
+ {
72
+ kind: 'validator',
73
+ commandName: 'make:validator',
74
+ description: 'Generate a Rune validator',
75
+ moduleScoped: true,
76
+ state: (name, input) =>
77
+ base(name, ensureSuffix(name, 'Validator'), input.module ?? 'validators'),
78
+ },
79
+ {
80
+ kind: 'provider',
81
+ commandName: 'make:provider',
82
+ description: 'Generate a service provider',
83
+ moduleScoped: false,
84
+ state: (name) => base(name, ensureSuffix(name, 'Provider'), ''),
85
+ },
86
+ {
87
+ kind: 'command',
88
+ commandName: 'make:command',
89
+ description: 'Generate a console command',
90
+ moduleScoped: false,
91
+ state: (name) => {
92
+ // `app:provision` is the command NAME; the class and the file come from
93
+ // its last segment, or the published stub would generate a command
94
+ // unreachable under the name it was asked for.
95
+ const segments = name.split(':')
96
+ const last = segments[segments.length - 1] ?? name
97
+ return {
98
+ className: toPascalCase(toSnakeCase(last)),
99
+ fileName: toSnakeCase(last),
100
+ name,
101
+ }
102
+ },
103
+ },
104
+ {
105
+ kind: 'middleware',
106
+ commandName: 'make:middleware',
107
+ description: 'Generate an HTTP middleware',
108
+ moduleScoped: false,
109
+ state: (name, input) => {
110
+ const fileName = toSnakeCase(stripSuffixInsensitive(name, 'middleware'))
111
+ const stack = input.stack ?? 'router'
112
+ const importer = `() => import('#middleware/${fileName}_middleware.js')`
113
+ // The line the user pastes into their kernel — different per stack, and
114
+ // wrong in a way that is hard to spot if it is guessed.
115
+ const registration =
116
+ stack === 'server'
117
+ ? `server.use([${importer}])`
118
+ : stack === 'named'
119
+ ? `router.named({ ${fileName}: ${importer} })`
120
+ : `router.use([${importer}])`
121
+ return {
122
+ className: `${toPascalCase(fileName)}Middleware`,
123
+ fileName,
124
+ name,
125
+ registration,
126
+ stack,
127
+ }
128
+ },
129
+ },
130
+ {
131
+ kind: 'event',
132
+ commandName: 'make:event',
133
+ description: 'Generate an event class',
134
+ moduleScoped: false,
135
+ state: (name) => {
136
+ const fileName = toSnakeCase(name)
137
+ return { className: toPascalCase(fileName), fileName, name }
138
+ },
139
+ },
140
+ {
141
+ kind: 'listener',
142
+ commandName: 'make:listener',
143
+ description: 'Generate an event listener',
144
+ moduleScoped: false,
145
+ state: (name, input) => {
146
+ const fileName = toSnakeCase(name)
147
+ const className = toPascalCase(fileName)
148
+ if (input.event === undefined) {
149
+ // Without `--event` there is nothing to type the handler with, and
150
+ // inventing an import would point at a file that does not exist.
151
+ return {
152
+ className,
153
+ fileName,
154
+ name,
155
+ importLine: '',
156
+ eventType: 'unknown',
157
+ registration: `emitter.on(SomeEvent, ${className})`,
158
+ }
159
+ }
160
+ const eventFile = toSnakeCase(input.event)
161
+ const eventClass = toPascalCase(eventFile)
162
+ return {
163
+ className,
164
+ fileName,
165
+ name,
166
+ importLine: `import type ${eventClass} from '#app/events/${eventFile}.js'\n\n`,
167
+ eventType: eventClass,
168
+ registration: `emitter.on(${eventClass}, ${className})`,
169
+ }
170
+ },
171
+ },
172
+ ]
173
+
174
+ export function generatorFor(kind: string): Generator | undefined {
175
+ return GENERATORS.find((generator) => generator.kind === kind)
176
+ }
@@ -0,0 +1,85 @@
1
+ /**
2
+ * The naming conventions the generators follow.
3
+ *
4
+ * Ported from the Rust generator they replace, case for case: a rename here
5
+ * changes what `make:controller user` produces, so the rules are written out
6
+ * rather than approximated.
7
+ */
8
+
9
+ /** Add the suffix unless the name already carries it. */
10
+ export function ensureSuffix(name: string, suffix: string): string {
11
+ return name.endsWith(suffix) ? name : `${name}${suffix}`
12
+ }
13
+
14
+ /** `user_profile` / `user-profile` / `user profile` → `UserProfile`. */
15
+ export function toPascalCase(name: string): string {
16
+ return name
17
+ .split(/[_\-\s]/)
18
+ .filter((part) => part !== '')
19
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
20
+ .join('')
21
+ }
22
+
23
+ /**
24
+ * `UserProfile` → `user_profile`, `HTTPServer` → `http_server`.
25
+ *
26
+ * The acronym case is why this is not a one-line regex: an underscore goes
27
+ * before a capital that FOLLOWS a lowercase, or that follows a capital and is
28
+ * followed by a lowercase — which is where `HTTPServer` splits.
29
+ */
30
+ export function toSnakeCase(name: string): string {
31
+ const chars = [...name]
32
+ let out = ''
33
+ for (const [index, char] of chars.entries()) {
34
+ if (char.toUpperCase() === char && char.toLowerCase() !== char) {
35
+ const previous = chars[index - 1]
36
+ const next = chars[index + 1]
37
+ const previousLower =
38
+ previous !== undefined &&
39
+ previous === previous.toLowerCase() &&
40
+ previous !== previous.toUpperCase()
41
+ const nextLower =
42
+ next !== undefined && next === next.toLowerCase() && next !== next.toUpperCase()
43
+ const previousUpper =
44
+ previous !== undefined &&
45
+ previous === previous.toUpperCase() &&
46
+ previous !== previous.toLowerCase()
47
+ if (index > 0 && (previousLower || (nextLower && previousUpper))) out += '_'
48
+ out += char.toLowerCase()
49
+ continue
50
+ }
51
+ out += char
52
+ }
53
+ return out
54
+ }
55
+
56
+ /** Drop a trailing `Middleware` / `middleware` / `_middleware`, whatever the case. */
57
+ export function stripSuffixInsensitive(name: string, suffix: string): string {
58
+ const lower = name.toLowerCase()
59
+ const suffixLower = suffix.toLowerCase()
60
+ if (lower.length > suffixLower.length && lower.endsWith(suffixLower)) {
61
+ return name.slice(0, name.length - suffix.length).replace(/[_-]+$/, '')
62
+ }
63
+ return name
64
+ }
65
+
66
+ /** Longer than this is not a name, it is a paste accident. */
67
+ export const MAX_NAME_LENGTH = 128
68
+
69
+ /**
70
+ * Is this a name a generator may build a path from?
71
+ *
72
+ * Refused rather than sanitised: a name with a separator in it is either a
73
+ * mistake or an attempt to write outside the project, and quietly rewriting it
74
+ * would produce a file somewhere the user did not ask for.
75
+ */
76
+ export function nameProblem(name: string): string | undefined {
77
+ if (name.trim() === '') return 'the name is empty'
78
+ if (name.length > MAX_NAME_LENGTH) return `the name is longer than ${MAX_NAME_LENGTH} characters`
79
+ if (/[/\\]/.test(name)) return 'a name may not contain a path separator'
80
+ if (name.includes('..')) return 'a name may not contain ".."'
81
+ if (!/^[A-Za-z][A-Za-z0-9_\-:]*$/.test(name)) {
82
+ return 'a name starts with a letter and holds letters, digits, "_", "-" or ":"'
83
+ }
84
+ return undefined
85
+ }
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Finding a stub, rendering it, and knowing where it goes.
3
+ *
4
+ * A stub is addressed the way `codemods.makeUsingStub` addresses one — a
5
+ * package's `stubsRoot` plus a path inside it, `make/controller.stub` — so a
6
+ * generator and a package's `configure()` hook read the same file through the
7
+ * same rule. The application's own copy under `stubs/` wins over the shipped
8
+ * one, which is what `ream eject` is for.
9
+ */
10
+
11
+ import * as fs from 'node:fs'
12
+ import * as path from 'node:path'
13
+ import { render, type StubState } from '../../stubs/template.js'
14
+
15
+ /** Where an application keeps its own copies — Adonis' `stubs/` root. */
16
+ export const PUBLISHED_ROOT = 'stubs'
17
+
18
+ /** The stubs this package ships. */
19
+ export const REAM_STUBS_ROOT = path.join(import.meta.dirname, '..', '..', '..', 'stubs')
20
+
21
+ export interface RenderedStub {
22
+ /** Relative to the project root, as the stub's front matter declares it. */
23
+ path: string
24
+ contents: string
25
+ /** Did the application's own copy win? */
26
+ published: boolean
27
+ }
28
+
29
+ /**
30
+ * A stub path that could escape its root never reaches the filesystem.
31
+ *
32
+ * `eject` takes one from the command line, so this is the boundary: no
33
+ * absolute path, no `..`, and a `.stub` file at the end of it.
34
+ */
35
+ export function isSafeStubPath(stubPath: string): boolean {
36
+ if (stubPath === '' || stubPath.length > 256) return false
37
+ if (path.isAbsolute(stubPath)) return false
38
+ const segments = stubPath.split(/[/\\]/)
39
+ if (segments.includes('..') || segments.includes('')) return false
40
+ return segments.every((segment) => /^[\w.-]+$/.test(segment))
41
+ }
42
+
43
+ /** Where the application's copy of `stubPath` would live. */
44
+ export function publishedPath(stubPath: string, cwd: string): string | undefined {
45
+ if (!isSafeStubPath(stubPath)) return undefined
46
+ return path.join(cwd, PUBLISHED_ROOT, stubPath)
47
+ }
48
+
49
+ /** Read `stubPath` — the application's copy when there is one. */
50
+ export function readStub(
51
+ stubsRoot: string,
52
+ stubPath: string,
53
+ cwd: string,
54
+ ): { source: string; published: boolean } {
55
+ const published = publishedPath(stubPath, cwd)
56
+ if (published !== undefined && fs.existsSync(published)) {
57
+ return { source: fs.readFileSync(published, 'utf8'), published: true }
58
+ }
59
+ if (!isSafeStubPath(stubPath)) {
60
+ throw new Error(`[make] unusable stub path: ${stubPath}`)
61
+ }
62
+ const shipped = path.join(stubsRoot, stubPath)
63
+ if (!fs.existsSync(shipped)) {
64
+ throw new Error(`[make] no stub at "${stubPath}" (looked in ${stubsRoot})`)
65
+ }
66
+ return { source: fs.readFileSync(shipped, 'utf8'), published: false }
67
+ }
68
+
69
+ /** Split `---\nto: …\n---\n<body>`; the front matter names the destination. */
70
+ export function splitFrontMatter(template: string): { to?: string; body: string } {
71
+ const trimmed = template.replace(/^[\r\n]+/, '')
72
+ if (!trimmed.startsWith('---')) return { body: template }
73
+ const after = trimmed.slice(3).replace(/^\r?\n/, '')
74
+ const end = after.indexOf('\n---')
75
+ if (end === -1) {
76
+ throw new Error('[make] a stub opened its front matter with `---` and never closed it')
77
+ }
78
+ const block = after.slice(0, end)
79
+ const body = after.slice(end + 4).replace(/^\r?\n/, '')
80
+ let to: string | undefined
81
+ for (const rawLine of block.split('\n')) {
82
+ const line = rawLine.trim()
83
+ if (line === '' || line.startsWith('#')) continue
84
+ const at = line.indexOf(':')
85
+ if (at === -1) throw new Error(`[make] unreadable stub front-matter line: \`${line}\``)
86
+ if (line.slice(0, at).trim() === 'to') to = line.slice(at + 1).trim()
87
+ }
88
+ return to === undefined ? { body } : { to, body }
89
+ }
90
+
91
+ /**
92
+ * The destination a stub declares, checked.
93
+ *
94
+ * Absolute paths and `..` are refused rather than normalised: a published stub
95
+ * is a file in the project, and a generator is not a way to write outside it.
96
+ */
97
+ function assertInsideProject(destination: string): void {
98
+ if (destination === '') throw new Error('[make] the stub declares an empty destination')
99
+ if (path.isAbsolute(destination)) {
100
+ throw new Error(`[make] a stub may not write to an absolute path: ${destination}`)
101
+ }
102
+ if (destination.split(/[/\\]/).includes('..')) {
103
+ throw new Error(`[make] a stub may not write outside the project: ${destination}`)
104
+ }
105
+ }
106
+
107
+ export function renderStub(
108
+ stubsRoot: string,
109
+ stubPath: string,
110
+ state: StubState,
111
+ cwd: string,
112
+ fallbackPath?: string,
113
+ ): RenderedStub {
114
+ const { source, published } = readStub(stubsRoot, stubPath, cwd)
115
+ const { to, body } = splitFrontMatter(source)
116
+ const destination = to === undefined ? fallbackPath : render(to, state)
117
+ if (destination === undefined) {
118
+ throw new Error(
119
+ `[make] the stub at "${stubPath}" declares no destination — add a \`to:\` front-matter line.`,
120
+ )
121
+ }
122
+ assertInsideProject(destination)
123
+ return { path: destination, contents: render(body, state), published }
124
+ }
125
+
126
+ /** `make/controller.stub` — the stub a generator of that kind reads. */
127
+ export function stubPathFor(kind: string): string {
128
+ return `make/${kind}.stub`
129
+ }
130
+
131
+ /** Render one of this package's own generator stubs. */
132
+ export function renderStubFor(kind: string, state: StubState, cwd: string): RenderedStub {
133
+ return renderStub(REAM_STUBS_ROOT, stubPathFor(kind), state, cwd)
134
+ }
package/src/console/ui.ts CHANGED
@@ -1,37 +1,25 @@
1
1
  /**
2
- * Console UI — `this.logger` and `this.prompt` on every command (Console parity).
2
+ * The one colour helper the Kernel's help and the prompts use.
3
3
  *
4
- * Kept dependency-free: the framework ships no colour or prompt library, and
5
- * pulling one in for the CLI surface alone is not worth the install weight.
4
+ * It is a thin call into `@c9up/lumen` rather than a second palette: two
5
+ * tables of escape codes in one package is how `[ warn ]` ends up yellow in
6
+ * one command and plain in another.
7
+ *
8
+ * The environment is read on EVERY call, not cached, because a command can be
9
+ * run in-process with the environment changed around it — which is exactly
10
+ * what the tests covering `FORCE_COLOR` do.
6
11
  */
7
12
 
8
13
  import { stdout } from 'node:process'
14
+ import { ansiColors, type Colors, silentColors, supportsColor } from '@c9up/lumen'
9
15
 
10
- /** Colour is opt-out via NO_COLOR and skipped when piped to a file. */
11
- function supportsColour(stream: NodeJS.WriteStream): boolean {
12
- if (process.env.NO_COLOR !== undefined && process.env.NO_COLOR !== '') return false
13
- if (process.env.FORCE_COLOR !== undefined && process.env.FORCE_COLOR !== '') return true
14
- return Boolean(stream.isTTY)
15
- }
16
-
17
- const CODES = {
18
- reset: '\u001B[0m',
19
- dim: '\u001B[2m',
20
- red: '\u001B[31m',
21
- green: '\u001B[32m',
22
- yellow: '\u001B[33m',
23
- blue: '\u001B[34m',
24
- magenta: '\u001B[35m',
25
- cyan: '\u001B[36m',
26
- } as const
27
-
28
- export type Colour = keyof Omit<typeof CODES, 'reset'>
16
+ export type Colour = 'dim' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan'
29
17
 
30
18
  export function colourise(
31
19
  text: string,
32
20
  colour: Colour,
33
21
  stream: NodeJS.WriteStream = stdout,
34
22
  ): string {
35
- if (!supportsColour(stream)) return text
36
- return `${CODES[colour]}${text}${CODES.reset}`
23
+ const colors: Colors = supportsColor(stream) ? ansiColors() : silentColors()
24
+ return colors[colour](text)
37
25
  }
package/src/index.ts CHANGED
@@ -272,8 +272,22 @@ export type {
272
272
 
273
273
  // ─── Codemods ───────────────────────────────────────────────
274
274
 
275
- export type { Codemods } from './Codemods.js'
276
- export { createCodemods } from './Codemods.js'
275
+ export {
276
+ type Codemods,
277
+ createCodemods,
278
+ type GeneratedStub,
279
+ type StubState,
280
+ } from './Codemods.js'
281
+ export {
282
+ compile as compileStub,
283
+ escapeHtml,
284
+ generate as generateStub,
285
+ render as renderStub,
286
+ type StubBlock,
287
+ StubSyntaxError,
288
+ type StubValue,
289
+ type TemplateOptions,
290
+ } from './stubs/template.js'
277
291
 
278
292
  // ─── Errors ─────────────────────────────────────────────────
279
293
 
@@ -385,4 +399,4 @@ export {
385
399
  StatsTracker,
386
400
  } from './scheduler/index.js'
387
401
 
388
- export const VERSION = '0.2.25'
402
+ export const VERSION = '0.2.26'
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `@c9up/ream/stubs` — the stub engine, and where this package keeps its own.
3
+ *
4
+ * Every Ream package exports a `stubsRoot` from this subpath: it is what
5
+ * `codemods.makeUsingStub(stubsRoot, 'make/controller.stub')` takes, and what
6
+ * `ream eject --pkg` reads to copy a template into the application.
7
+ */
8
+
9
+ import * as path from 'node:path'
10
+
11
+ export * from './template.js'
12
+
13
+ /** `<package>/stubs` — resolved from this file, so it survives the build. */
14
+ export const stubsRoot = path.join(import.meta.dirname, '..', '..', 'stubs')