@c9up/ream 0.2.24 → 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.
- package/README.md +2 -0
- package/dist/Codemods.d.ts +13 -0
- package/dist/Codemods.d.ts.map +1 -1
- package/dist/Codemods.js +158 -23
- package/dist/Codemods.js.map +1 -1
- package/dist/Ignitor.d.ts +28 -0
- package/dist/Ignitor.d.ts.map +1 -1
- package/dist/Ignitor.js +15 -15
- package/dist/Ignitor.js.map +1 -1
- package/dist/console/Kernel.d.ts.map +1 -1
- package/dist/console/Kernel.js +20 -1
- package/dist/console/Kernel.js.map +1 -1
- package/dist/console/cliui.d.ts +9 -245
- package/dist/console/cliui.d.ts.map +1 -1
- package/dist/console/cliui.js +9 -583
- package/dist/console/cliui.js.map +1 -1
- package/dist/console/make/commands.d.ts +19 -0
- package/dist/console/make/commands.d.ts.map +1 -0
- package/dist/console/make/commands.js +252 -0
- package/dist/console/make/commands.js.map +1 -0
- package/dist/console/make/eject.d.ts +28 -0
- package/dist/console/make/eject.d.ts.map +1 -0
- package/dist/console/make/eject.js +161 -0
- package/dist/console/make/eject.js.map +1 -0
- package/dist/console/make/flush.d.ts +51 -0
- package/dist/console/make/flush.d.ts.map +1 -0
- package/dist/console/make/flush.js +93 -0
- package/dist/console/make/flush.js.map +1 -0
- package/dist/console/make/generators.d.ts +36 -0
- package/dist/console/make/generators.d.ts.map +1 -0
- package/dist/console/make/generators.js +148 -0
- package/dist/console/make/generators.js.map +1 -0
- package/dist/console/make/naming.d.ts +32 -0
- package/dist/console/make/naming.d.ts.map +1 -0
- package/dist/console/make/naming.js +82 -0
- package/dist/console/make/naming.js.map +1 -0
- package/dist/console/make/resolve.d.ts +46 -0
- package/dist/console/make/resolve.d.ts.map +1 -0
- package/dist/console/make/resolve.js +113 -0
- package/dist/console/make/resolve.js.map +1 -0
- package/dist/console/ui.d.ts +9 -15
- package/dist/console/ui.d.ts.map +1 -1
- package/dist/console/ui.js +11 -24
- package/dist/console/ui.js.map +1 -1
- package/dist/dev/hmr.d.ts +52 -4
- package/dist/dev/hmr.d.ts.map +1 -1
- package/dist/dev/hmr.js +75 -9
- package/dist/dev/hmr.js.map +1 -1
- package/dist/dev/hotGlob.d.ts +10 -3
- package/dist/dev/hotGlob.d.ts.map +1 -1
- package/dist/dev/hotGlob.js +28 -3
- package/dist/dev/hotGlob.js.map +1 -1
- package/dist/hot.js +56 -3
- package/dist/hot.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/stubs/index.d.ts +11 -0
- package/dist/stubs/index.d.ts.map +1 -0
- package/dist/stubs/index.js +12 -0
- package/dist/stubs/index.js.map +1 -0
- package/dist/stubs/template.d.ts +63 -0
- package/dist/stubs/template.d.ts.map +1 -0
- package/dist/stubs/template.js +209 -0
- package/dist/stubs/template.js.map +1 -0
- package/events.win32-x64-msvc.node +0 -0
- package/index.win32-x64-msvc.node +0 -0
- package/package.json +7 -1
- package/scheduler.win32-x64-msvc.node +0 -0
- package/src/Codemods.ts +206 -29
- package/src/Ignitor.ts +44 -14
- package/src/console/Kernel.ts +21 -1
- package/src/console/cliui.ts +44 -754
- package/src/console/make/commands.ts +270 -0
- package/src/console/make/eject.ts +163 -0
- package/src/console/make/flush.ts +125 -0
- package/src/console/make/generators.ts +176 -0
- package/src/console/make/naming.ts +85 -0
- package/src/console/make/resolve.ts +134 -0
- package/src/console/ui.ts +12 -24
- package/src/dev/hmr.ts +102 -9
- package/src/dev/hotGlob.ts +28 -3
- package/src/hot.ts +59 -3
- package/src/index.ts +17 -3
- package/src/stubs/index.ts +14 -0
- package/src/stubs/template.ts +262 -0
- package/stubs/make/command.stub +29 -0
- package/stubs/make/controller.stub +30 -0
- package/stubs/make/entity.stub +11 -0
- package/stubs/make/event.stub +13 -0
- package/stubs/make/listener.stub +13 -0
- package/stubs/make/middleware.stub +16 -0
- package/stubs/make/provider.stub +26 -0
- package/stubs/make/service.stub +27 -0
- package/stubs/make/validator.stub +10 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `make:` commands.
|
|
3
|
+
*
|
|
4
|
+
* They used to live in the `ream` binary, which meant Rust had to render their
|
|
5
|
+
* stubs — and rendering a stub means evaluating `{{#if resourceful}}`, which is
|
|
6
|
+
* JavaScript. Two renderers is two behaviours waiting to drift, so the
|
|
7
|
+
* generators moved to where the engine already is, the way `make:migration`
|
|
8
|
+
* moved to atlas.
|
|
9
|
+
*
|
|
10
|
+
* One class per command, built from the generator table: Adonis ships a class
|
|
11
|
+
* per command too, and the table is what keeps ten of them from being ten
|
|
12
|
+
* copies. `--force` and the skip-rather-than-clobber rule are Adonis'.
|
|
13
|
+
* `--dry-run` and `--json` are ours, and they are why `@c9up/ream-mcp` can
|
|
14
|
+
* show a plan before anything is written.
|
|
15
|
+
*/
|
|
16
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
17
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
19
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
20
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
21
|
+
};
|
|
22
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
23
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
24
|
+
};
|
|
25
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
26
|
+
import { args, flags } from '../decorators.js';
|
|
27
|
+
import Eject from './eject.js';
|
|
28
|
+
import { flush, outcomePayload, plannedFile } from './flush.js';
|
|
29
|
+
import { GENERATORS, generatorFor } from './generators.js';
|
|
30
|
+
import { nameProblem } from './naming.js';
|
|
31
|
+
import { renderStubFor } from './resolve.js';
|
|
32
|
+
/**
|
|
33
|
+
* Validate the names and render the stub. Shared by the single-kind commands
|
|
34
|
+
* and by `make:module`, so all four files are checked before the first write.
|
|
35
|
+
*/
|
|
36
|
+
function prepare(generator, module, name, extra, cwd) {
|
|
37
|
+
for (const [label, value] of [
|
|
38
|
+
['module', module],
|
|
39
|
+
['name', name],
|
|
40
|
+
]) {
|
|
41
|
+
if (value === undefined)
|
|
42
|
+
continue;
|
|
43
|
+
const problem = nameProblem(value);
|
|
44
|
+
if (problem !== undefined)
|
|
45
|
+
return { error: `${label} "${value}": ${problem}` };
|
|
46
|
+
}
|
|
47
|
+
const state = generator.state(name, {
|
|
48
|
+
...(module === undefined ? {} : { module }),
|
|
49
|
+
...(extra.stack === undefined ? {} : { stack: extra.stack }),
|
|
50
|
+
...(extra.event === undefined ? {} : { event: extra.event }),
|
|
51
|
+
});
|
|
52
|
+
try {
|
|
53
|
+
const rendered = renderStubFor(generator.kind, state, cwd);
|
|
54
|
+
return {
|
|
55
|
+
file: plannedFile(rendered.path, rendered.contents, cwd),
|
|
56
|
+
published: rendered.published,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
return { error: error instanceof Error ? error.message : String(error) };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Write the plan and report it — as JSON when asked, as Adonis' action lines
|
|
65
|
+
* otherwise. `--json` prints nothing else: its whole contract is that the last
|
|
66
|
+
* line of stdout is the payload, and a stray warning above it is how that
|
|
67
|
+
* breaks.
|
|
68
|
+
*/
|
|
69
|
+
function report(command, entries, warnings, options) {
|
|
70
|
+
const outcome = flush(entries, warnings, options);
|
|
71
|
+
if (options.json) {
|
|
72
|
+
process.stdout.write(`${JSON.stringify(outcomePayload(outcome))}\n`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (outcome.status === 'planned') {
|
|
76
|
+
for (const file of outcome.files) {
|
|
77
|
+
// The path AND the contents: a dry run that showed only the path would
|
|
78
|
+
// not answer the question it is asked.
|
|
79
|
+
command.logger.info(`${file.path}${file.exists ? ' (exists)' : ''} — dry run`);
|
|
80
|
+
command.logger.log(file.content);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
for (const file of [...outcome.createdFiles, ...outcome.modifiedFiles]) {
|
|
85
|
+
command.logger.action(`create ${file}`).succeeded();
|
|
86
|
+
}
|
|
87
|
+
for (const file of outcome.skippedFiles) {
|
|
88
|
+
command.logger.action(`create ${file}`).skipped('file already exists, use --force');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
for (const warning of warnings)
|
|
92
|
+
command.logger.warning(warning);
|
|
93
|
+
}
|
|
94
|
+
/** Build the command class for one generator. */
|
|
95
|
+
function makeCommand(generator) {
|
|
96
|
+
class MakeCommand extends BaseCommand {
|
|
97
|
+
static commandName = generator.commandName;
|
|
98
|
+
static description = generator.description;
|
|
99
|
+
// Filesystem only: scaffolding a file must not need a booted application,
|
|
100
|
+
// let alone a reachable database.
|
|
101
|
+
static options = { startApp: false };
|
|
102
|
+
async run() {
|
|
103
|
+
// Two positionals for a module-scoped generator, one for the rest.
|
|
104
|
+
const module = generator.moduleScoped ? this.first : undefined;
|
|
105
|
+
const name = generator.moduleScoped ? (this.second ?? '') : this.first;
|
|
106
|
+
if (generator.moduleScoped && this.second === undefined) {
|
|
107
|
+
this.logger.error(`${generator.commandName} takes a module and a name`);
|
|
108
|
+
this.exitCode = 1;
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const cwd = process.cwd();
|
|
112
|
+
const prepared = prepare(generator, module, name, {
|
|
113
|
+
...(this.stack === undefined ? {} : { stack: this.stack }),
|
|
114
|
+
...(this.event === undefined ? {} : { event: this.event }),
|
|
115
|
+
}, cwd);
|
|
116
|
+
if ('error' in prepared) {
|
|
117
|
+
this.logger.error(prepared.error);
|
|
118
|
+
this.exitCode = 1;
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
report(this, [prepared.file], [], {
|
|
122
|
+
cwd,
|
|
123
|
+
dryRun: this.dryRun === true,
|
|
124
|
+
force: this.force === true,
|
|
125
|
+
json: this.json === true,
|
|
126
|
+
});
|
|
127
|
+
if (prepared.published && this.json !== true) {
|
|
128
|
+
// Worth saying: the output came from the project's own stub, so a
|
|
129
|
+
// surprise in it is not a bug in ream.
|
|
130
|
+
this.logger.info(`rendered from stubs/make/${generator.kind}.stub`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
__decorate([
|
|
135
|
+
args.string({
|
|
136
|
+
description: 'Module directory under app/',
|
|
137
|
+
required: generator.moduleScoped,
|
|
138
|
+
}),
|
|
139
|
+
__metadata("design:type", String)
|
|
140
|
+
], MakeCommand.prototype, "first", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
args.string({ description: 'Name of the generated file', required: false }),
|
|
143
|
+
__metadata("design:type", String)
|
|
144
|
+
], MakeCommand.prototype, "second", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
flags.boolean({
|
|
147
|
+
description: 'Forcefully overwrite an existing file',
|
|
148
|
+
alias: 'f',
|
|
149
|
+
}),
|
|
150
|
+
__metadata("design:type", Boolean)
|
|
151
|
+
], MakeCommand.prototype, "force", void 0);
|
|
152
|
+
__decorate([
|
|
153
|
+
flags.boolean({
|
|
154
|
+
description: 'Print what would be written, without writing it',
|
|
155
|
+
}),
|
|
156
|
+
__metadata("design:type", Boolean)
|
|
157
|
+
], MakeCommand.prototype, "dryRun", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
flags.boolean({ description: 'Report the outcome as a single JSON object' }),
|
|
160
|
+
__metadata("design:type", Boolean)
|
|
161
|
+
], MakeCommand.prototype, "json", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
flags.string({
|
|
164
|
+
description: 'Which stack a middleware registers on: router, server or named',
|
|
165
|
+
}),
|
|
166
|
+
__metadata("design:type", String)
|
|
167
|
+
], MakeCommand.prototype, "stack", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
flags.string({ description: 'Event class this listener handles' }),
|
|
170
|
+
__metadata("design:type", String)
|
|
171
|
+
], MakeCommand.prototype, "event", void 0);
|
|
172
|
+
// The class is anonymous to the debugger otherwise, and a stack trace
|
|
173
|
+
// naming `MakeCommand` ten times helps nobody.
|
|
174
|
+
Object.defineProperty(MakeCommand, 'name', {
|
|
175
|
+
value: `Make${generator.kind.charAt(0).toUpperCase()}${generator.kind.slice(1)}`,
|
|
176
|
+
});
|
|
177
|
+
return MakeCommand;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* `make:module` — an entity, a controller and a validator in one go.
|
|
181
|
+
*
|
|
182
|
+
* NOT the migration the binary also emitted: a migration is atlas' format and
|
|
183
|
+
* atlas' directory, and ream inventing one would produce a file its own
|
|
184
|
+
* `migration:run` never reads. `make:migration` is atlas' command, and this
|
|
185
|
+
* says so rather than guessing.
|
|
186
|
+
*
|
|
187
|
+
* The three are rendered before any is written, so a stub that fails to render
|
|
188
|
+
* leaves nothing half-generated behind.
|
|
189
|
+
*/
|
|
190
|
+
class MakeModule extends BaseCommand {
|
|
191
|
+
static commandName = 'make:module';
|
|
192
|
+
static description = 'Generate an entity, a controller and a validator';
|
|
193
|
+
static options = { startApp: false };
|
|
194
|
+
async run() {
|
|
195
|
+
const cwd = process.cwd();
|
|
196
|
+
const entries = [];
|
|
197
|
+
for (const kind of ['entity', 'controller', 'validator']) {
|
|
198
|
+
const generator = generatorFor(kind);
|
|
199
|
+
if (generator === undefined) {
|
|
200
|
+
this.logger.error(`no generator for "${kind}"`);
|
|
201
|
+
this.exitCode = 1;
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const prepared = prepare(generator, this.module, this.name, {}, cwd);
|
|
205
|
+
if ('error' in prepared) {
|
|
206
|
+
this.logger.error(prepared.error);
|
|
207
|
+
this.exitCode = 1;
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
entries.push(prepared.file);
|
|
211
|
+
}
|
|
212
|
+
const warnings = [
|
|
213
|
+
// Said, not done: a barrel is the application's file, and appending to it
|
|
214
|
+
// blindly is how an export ends up duplicated.
|
|
215
|
+
`if app/${this.module}/index.ts exists, add the new exports to it yourself`,
|
|
216
|
+
"no migration was generated — that one is atlas': run `ream make:migration`",
|
|
217
|
+
];
|
|
218
|
+
report(this, entries, warnings, {
|
|
219
|
+
cwd,
|
|
220
|
+
dryRun: this.dryRun === true,
|
|
221
|
+
force: this.force === true,
|
|
222
|
+
json: this.json === true,
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
__decorate([
|
|
227
|
+
args.string({ description: 'Module directory under app/' }),
|
|
228
|
+
__metadata("design:type", String)
|
|
229
|
+
], MakeModule.prototype, "module", void 0);
|
|
230
|
+
__decorate([
|
|
231
|
+
args.string({ description: 'Name shared by the generated files' }),
|
|
232
|
+
__metadata("design:type", String)
|
|
233
|
+
], MakeModule.prototype, "name", void 0);
|
|
234
|
+
__decorate([
|
|
235
|
+
flags.boolean({ description: 'Forcefully overwrite existing files', alias: 'f' }),
|
|
236
|
+
__metadata("design:type", Boolean)
|
|
237
|
+
], MakeModule.prototype, "force", void 0);
|
|
238
|
+
__decorate([
|
|
239
|
+
flags.boolean({ description: 'Print what would be written, without writing it' }),
|
|
240
|
+
__metadata("design:type", Boolean)
|
|
241
|
+
], MakeModule.prototype, "dryRun", void 0);
|
|
242
|
+
__decorate([
|
|
243
|
+
flags.boolean({ description: 'Report the outcome as a single JSON object' }),
|
|
244
|
+
__metadata("design:type", Boolean)
|
|
245
|
+
], MakeModule.prototype, "json", void 0);
|
|
246
|
+
/** Every `make:` command, built once. */
|
|
247
|
+
export const MAKE_COMMANDS = [
|
|
248
|
+
...GENERATORS.map(makeCommand),
|
|
249
|
+
MakeModule,
|
|
250
|
+
Eject,
|
|
251
|
+
];
|
|
252
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../src/console/make/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,KAAK,MAAM,YAAY,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,cAAc,EAAoB,WAAW,EAAE,MAAM,YAAY,CAAA;AACjF,OAAO,EAAE,UAAU,EAAkB,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAK5C;;;GAGG;AACH,SAAS,OAAO,CACd,SAAoB,EACpB,MAA0B,EAC1B,IAAY,EACZ,KAAyC,EACzC,GAAW;IAEX,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI;QAC3B,CAAC,QAAQ,EAAE,MAAM,CAAC;QAClB,CAAC,MAAM,EAAE,IAAI,CAAC;KACN,EAAE,CAAC;QACX,IAAI,KAAK,KAAK,SAAS;YAAE,SAAQ;QACjC,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,CAAA;QAClC,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,KAAK,KAAK,MAAM,OAAO,EAAE,EAAE,CAAA;IAChF,CAAC;IAED,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE;QAClC,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3C,GAAG,CAAC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,KAAK,EAAE,IAAI,CAAC,KAAK,KAAK,IAAI;YAC1B,IAAI,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI;SACzB,CAAC,CAAA;IACJ,CAAC;;AA/CO;IADP,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;;0CACtC;AAGd;IADP,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC;;wCAC/C;AAGZ;IADP,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,qCAAqC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;;yCAC3D;AAGf;IADP,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC;;0CAC1D;AAGhB;IADP,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,4CAA4C,EAAE,CAAC;;wCACvD;AAsCxB,yCAAyC;AACzC,MAAM,CAAC,MAAM,aAAa,GAA4B;IACpD,GAAG,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC;IAC9B,UAAU;IACV,KAAK;CACN,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `eject` — copy a package's stub into the application so it can be edited.
|
|
3
|
+
*
|
|
4
|
+
* The other half of the override rule: `renderStub` prefers `stubs/<path>`
|
|
5
|
+
* when the application has one, and this is how it gets there. Copied
|
|
6
|
+
* verbatim, front matter included, because the `to:` line is part of what a
|
|
7
|
+
* project may want to change.
|
|
8
|
+
*
|
|
9
|
+
* Adonis' command, name and argument included — `node ace eject make/controller
|
|
10
|
+
* --pkg=@adonisjs/lucid`. `--pkg` reads the package's own `stubsRoot`, which
|
|
11
|
+
* every Ream package exports from its `./stubs` subpath, so ejecting atlas' or
|
|
12
|
+
* warden's templates needs nothing added here.
|
|
13
|
+
*/
|
|
14
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
15
|
+
export default class Eject extends BaseCommand {
|
|
16
|
+
#private;
|
|
17
|
+
static commandName: string;
|
|
18
|
+
static description: string;
|
|
19
|
+
static options: {
|
|
20
|
+
startApp: boolean;
|
|
21
|
+
};
|
|
22
|
+
stubPath?: string;
|
|
23
|
+
pkg?: string;
|
|
24
|
+
list?: boolean;
|
|
25
|
+
force?: boolean;
|
|
26
|
+
run(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=eject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eject.d.ts","sourceRoot":"","sources":["../../../src/console/make/eject.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AA2D/C,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,WAAW;;IAC5C,OAAgB,WAAW,SAAU;IACrC,OAAgB,WAAW,SAC0D;IACrF,OAAgB,OAAO;;MAAsB;IAMrC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAGjB,GAAG,CAAC,EAAE,MAAM,CAAA;IAGZ,IAAI,CAAC,EAAE,OAAO,CAAA;IAGd,KAAK,CAAC,EAAE,OAAO,CAAA;IAEjB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAkE3B"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `eject` — copy a package's stub into the application so it can be edited.
|
|
3
|
+
*
|
|
4
|
+
* The other half of the override rule: `renderStub` prefers `stubs/<path>`
|
|
5
|
+
* when the application has one, and this is how it gets there. Copied
|
|
6
|
+
* verbatim, front matter included, because the `to:` line is part of what a
|
|
7
|
+
* project may want to change.
|
|
8
|
+
*
|
|
9
|
+
* Adonis' command, name and argument included — `node ace eject make/controller
|
|
10
|
+
* --pkg=@adonisjs/lucid`. `--pkg` reads the package's own `stubsRoot`, which
|
|
11
|
+
* every Ream package exports from its `./stubs` subpath, so ejecting atlas' or
|
|
12
|
+
* warden's templates needs nothing added here.
|
|
13
|
+
*/
|
|
14
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
+
};
|
|
20
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
21
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
+
};
|
|
23
|
+
import * as fs from 'node:fs';
|
|
24
|
+
import * as path from 'node:path';
|
|
25
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
26
|
+
import { args, flags } from '../decorators.js';
|
|
27
|
+
import { GENERATORS } from './generators.js';
|
|
28
|
+
import { isSafeStubPath, PUBLISHED_ROOT, REAM_STUBS_ROOT, readStub, splitFrontMatter, stubPathFor, } from './resolve.js';
|
|
29
|
+
/** Every `{{ name }}` a stub reads, so the listing cannot advertise a wrong one. */
|
|
30
|
+
function variablesOf(source) {
|
|
31
|
+
const found = new Set();
|
|
32
|
+
for (const match of source.matchAll(/\{\{\{?\s*([\w.]+)\s*\}?\}\}/g)) {
|
|
33
|
+
const name = match[1];
|
|
34
|
+
if (name !== undefined)
|
|
35
|
+
found.add(name);
|
|
36
|
+
}
|
|
37
|
+
return [...found].sort();
|
|
38
|
+
}
|
|
39
|
+
/** The `stubsRoot` a module exports, when it exports one. */
|
|
40
|
+
async function stubsRootFrom(specifier) {
|
|
41
|
+
try {
|
|
42
|
+
const loaded = await import(specifier);
|
|
43
|
+
if (typeof loaded !== 'object' || loaded === null)
|
|
44
|
+
return undefined;
|
|
45
|
+
const root = loaded.stubsRoot;
|
|
46
|
+
return typeof root === 'string' ? root : undefined;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The `stubsRoot` a package exports, or nothing when it exports none.
|
|
54
|
+
*
|
|
55
|
+
* Read from the package rather than guessed from `node_modules/<pkg>/stubs`:
|
|
56
|
+
* a package is free to keep them elsewhere, and only its own export says
|
|
57
|
+
* where. Adonis reads the entrypoint, so that is tried first; the `./stubs`
|
|
58
|
+
* subpath is tried after, because a barrel that also runs in a browser cannot
|
|
59
|
+
* export a filesystem path — which is why Ream packages put it on a subpath.
|
|
60
|
+
*/
|
|
61
|
+
async function stubsRootOf(pkg) {
|
|
62
|
+
if (pkg === '@c9up/ream')
|
|
63
|
+
return REAM_STUBS_ROOT;
|
|
64
|
+
return (await stubsRootFrom(pkg)) ?? (await stubsRootFrom(`${pkg}/stubs`));
|
|
65
|
+
}
|
|
66
|
+
/** Every `.stub` under `root`, as paths relative to it. */
|
|
67
|
+
function stubsUnder(root, prefix = '') {
|
|
68
|
+
const found = [];
|
|
69
|
+
for (const entry of fs.readdirSync(path.join(root, prefix), { withFileTypes: true })) {
|
|
70
|
+
const relative = prefix === '' ? entry.name : `${prefix}/${entry.name}`;
|
|
71
|
+
if (entry.isDirectory())
|
|
72
|
+
found.push(...stubsUnder(root, relative));
|
|
73
|
+
else if (entry.name.endsWith('.stub'))
|
|
74
|
+
found.push(relative);
|
|
75
|
+
}
|
|
76
|
+
return found.sort();
|
|
77
|
+
}
|
|
78
|
+
export default class Eject extends BaseCommand {
|
|
79
|
+
static commandName = 'eject';
|
|
80
|
+
static description = 'Copy a package stub into stubs/ so the project can customise what make: generates';
|
|
81
|
+
static options = { startApp: false };
|
|
82
|
+
async run() {
|
|
83
|
+
const pkg = this.pkg ?? '@c9up/ream';
|
|
84
|
+
const stubsRoot = await stubsRootOf(pkg);
|
|
85
|
+
if (stubsRoot === undefined || !fs.existsSync(stubsRoot)) {
|
|
86
|
+
this.logger.error(`"${pkg}" ships no stubs (no \`stubsRoot\` on its ./stubs subpath)`);
|
|
87
|
+
this.exitCode = 1;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (this.list === true) {
|
|
91
|
+
this.#printList(stubsRoot);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const requested = this.stubPath;
|
|
95
|
+
if (requested !== undefined && !isSafeStubPath(requested)) {
|
|
96
|
+
this.logger.error(`unusable stub path: ${requested}`);
|
|
97
|
+
this.exitCode = 1;
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
// A path with no `.stub` suffix names a directory — `eject make` takes the
|
|
101
|
+
// lot, which is what makes ejecting every generator one command.
|
|
102
|
+
const available = stubsUnder(stubsRoot);
|
|
103
|
+
const selected = requested === undefined
|
|
104
|
+
? available
|
|
105
|
+
: requested.endsWith('.stub')
|
|
106
|
+
? available.filter((candidate) => candidate === requested)
|
|
107
|
+
: available.filter((candidate) => candidate.startsWith(`${requested}/`));
|
|
108
|
+
if (selected.length === 0) {
|
|
109
|
+
this.logger.error(`"${pkg}" ships no stub matching "${requested ?? ''}"`);
|
|
110
|
+
this.exitCode = 1;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
for (const stub of selected) {
|
|
114
|
+
const destination = path.join(process.cwd(), PUBLISHED_ROOT, stub);
|
|
115
|
+
if (fs.existsSync(destination) && this.force !== true) {
|
|
116
|
+
this.logger
|
|
117
|
+
.action(`eject ${PUBLISHED_ROOT}/${stub}`)
|
|
118
|
+
.skipped('already ejected, use --force');
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
122
|
+
// The shipped one, never the project's copy: ejecting over your own edit
|
|
123
|
+
// with your own edit is a no-op that reads as success.
|
|
124
|
+
fs.writeFileSync(destination, fs.readFileSync(path.join(stubsRoot, stub)));
|
|
125
|
+
this.logger.action(`eject ${PUBLISHED_ROOT}/${stub}`).succeeded();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/** What each generator reads, taken from the stub rather than a kept list. */
|
|
129
|
+
#printList(stubsRoot) {
|
|
130
|
+
const table = this.ui.table().head(['Stub', 'Variables']);
|
|
131
|
+
const generatorStubs = new Set(GENERATORS.map((generator) => stubPathFor(generator.kind)));
|
|
132
|
+
for (const stub of stubsUnder(stubsRoot)) {
|
|
133
|
+
const { source } = readStub(stubsRoot, stub, path.join(process.cwd(), '__none__'));
|
|
134
|
+
const variables = generatorStubs.has(stub)
|
|
135
|
+
? variablesOf(splitFrontMatter(source).body).join(', ')
|
|
136
|
+
: '';
|
|
137
|
+
table.row([stub, variables]);
|
|
138
|
+
}
|
|
139
|
+
table.render();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
__decorate([
|
|
143
|
+
args.string({
|
|
144
|
+
description: 'The stub to copy, e.g. make/controller.stub — omit for a directory or all',
|
|
145
|
+
required: false,
|
|
146
|
+
}),
|
|
147
|
+
__metadata("design:type", String)
|
|
148
|
+
], Eject.prototype, "stubPath", void 0);
|
|
149
|
+
__decorate([
|
|
150
|
+
flags.string({ description: 'Which package to read the stub from' }),
|
|
151
|
+
__metadata("design:type", String)
|
|
152
|
+
], Eject.prototype, "pkg", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
flags.boolean({ description: 'List what can be ejected, and the variables each stub reads' }),
|
|
155
|
+
__metadata("design:type", Boolean)
|
|
156
|
+
], Eject.prototype, "list", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
flags.boolean({ description: 'Overwrite a stub the project already ejected' }),
|
|
159
|
+
__metadata("design:type", Boolean)
|
|
160
|
+
], Eject.prototype, "force", void 0);
|
|
161
|
+
//# sourceMappingURL=eject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eject.js","sourceRoot":"","sources":["../../../src/console/make/eject.ts"],"names":[],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QAC1F,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACzC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC,CAAA;YAClF,MAAM,SAAS,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC;gBACxC,CAAC,CAAC,WAAW,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;gBACvD,CAAC,CAAC,EAAE,CAAA;YACN,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAA;QAC9B,CAAC;QACD,KAAK,CAAC,MAAM,EAAE,CAAA;IAChB,CAAC;;AA5EO;IAJP,IAAI,CAAC,MAAM,CAAC;QACX,WAAW,EAAE,2EAA2E;QACxF,QAAQ,EAAE,KAAK;KAChB,CAAC;;uCACuB;AAGjB;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC;;kCACjD;AAGZ;IADP,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,6DAA6D,EAAE,CAAC;;mCACxE;AAGd;IADP,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;;oCACxD"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turning rendered stubs into files on disk.
|
|
3
|
+
*
|
|
4
|
+
* Split from the commands because the rules are the same for one file and for
|
|
5
|
+
* the three `make:module` emits, and they are not the obvious ones:
|
|
6
|
+
*
|
|
7
|
+
* - A file that is already there is SKIPPED, not overwritten and not an
|
|
8
|
+
* error — Adonis' generators answer `SKIPPED:` and carry on, and `--force`
|
|
9
|
+
* is how one asks for the overwrite.
|
|
10
|
+
* - With `--force`, a failure half-way through puts back what the same run
|
|
11
|
+
* had already written. A generator that leaves a clobbered entity behind
|
|
12
|
+
* after failing on the controller is worse than one that writes nothing.
|
|
13
|
+
* That rollback is ours, not Adonis': its generators never overwrite more
|
|
14
|
+
* than one file per command.
|
|
15
|
+
*/
|
|
16
|
+
/** One file a generator intends to write. */
|
|
17
|
+
export interface PlannedFile {
|
|
18
|
+
path: string;
|
|
19
|
+
content: string;
|
|
20
|
+
/** Was something already there? Answered while planning, not after. */
|
|
21
|
+
exists: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface FlushOptions {
|
|
24
|
+
cwd: string;
|
|
25
|
+
dryRun: boolean;
|
|
26
|
+
force: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* What a run did, in the shapes `--json` prints — see {@link outcomePayload}.
|
|
30
|
+
*/
|
|
31
|
+
export type FlushOutcome = {
|
|
32
|
+
status: 'planned';
|
|
33
|
+
files: PlannedFile[];
|
|
34
|
+
warnings: string[];
|
|
35
|
+
} | {
|
|
36
|
+
status: 'written';
|
|
37
|
+
createdFiles: string[];
|
|
38
|
+
modifiedFiles: string[];
|
|
39
|
+
skippedFiles: string[];
|
|
40
|
+
warnings: string[];
|
|
41
|
+
};
|
|
42
|
+
/** `exists` is read now, not at write time: a plan describes one moment. */
|
|
43
|
+
export declare function plannedFile(destination: string, content: string, cwd: string): PlannedFile;
|
|
44
|
+
export declare function flush(entries: readonly PlannedFile[], warnings: readonly string[], options: FlushOptions): FlushOutcome;
|
|
45
|
+
/**
|
|
46
|
+
* The outcome as the JSON object `--json` prints, kept in one place because it
|
|
47
|
+
* is a contract with another package rather than a debug dump: `ream-mcp` reads
|
|
48
|
+
* the last line of stdout and dispatches on which shape it is.
|
|
49
|
+
*/
|
|
50
|
+
export declare function outcomePayload(outcome: FlushOutcome): Record<string, unknown>;
|
|
51
|
+
//# sourceMappingURL=flush.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flush.d.ts","sourceRoot":"","sources":["../../../src/console/make/flush.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,6CAA6C;AAC7C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,uEAAuE;IACvE,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;CACf;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,WAAW,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,GAC/D;IACE,MAAM,EAAE,SAAS,CAAA;IACjB,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB,CAAA;AAEL,4EAA4E;AAC5E,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAM1F;AAED,wBAAgB,KAAK,CACnB,OAAO,EAAE,SAAS,WAAW,EAAE,EAC/B,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,OAAO,EAAE,YAAY,GACpB,YAAY,CA+Bd;AAmBD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAU7E"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turning rendered stubs into files on disk.
|
|
3
|
+
*
|
|
4
|
+
* Split from the commands because the rules are the same for one file and for
|
|
5
|
+
* the three `make:module` emits, and they are not the obvious ones:
|
|
6
|
+
*
|
|
7
|
+
* - A file that is already there is SKIPPED, not overwritten and not an
|
|
8
|
+
* error — Adonis' generators answer `SKIPPED:` and carry on, and `--force`
|
|
9
|
+
* is how one asks for the overwrite.
|
|
10
|
+
* - With `--force`, a failure half-way through puts back what the same run
|
|
11
|
+
* had already written. A generator that leaves a clobbered entity behind
|
|
12
|
+
* after failing on the controller is worse than one that writes nothing.
|
|
13
|
+
* That rollback is ours, not Adonis': its generators never overwrite more
|
|
14
|
+
* than one file per command.
|
|
15
|
+
*/
|
|
16
|
+
import * as fs from 'node:fs';
|
|
17
|
+
import * as path from 'node:path';
|
|
18
|
+
/** `exists` is read now, not at write time: a plan describes one moment. */
|
|
19
|
+
export function plannedFile(destination, content, cwd) {
|
|
20
|
+
return {
|
|
21
|
+
path: destination,
|
|
22
|
+
content,
|
|
23
|
+
exists: fs.existsSync(path.resolve(cwd, destination)),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function flush(entries, warnings, options) {
|
|
27
|
+
if (options.dryRun) {
|
|
28
|
+
return { status: 'planned', files: [...entries], warnings: [...warnings] };
|
|
29
|
+
}
|
|
30
|
+
const createdFiles = [];
|
|
31
|
+
const modifiedFiles = [];
|
|
32
|
+
const skippedFiles = [];
|
|
33
|
+
/** What each written path held before, so a later failure can put it back. */
|
|
34
|
+
const rollbacks = [];
|
|
35
|
+
try {
|
|
36
|
+
for (const entry of entries) {
|
|
37
|
+
if (entry.exists && !options.force) {
|
|
38
|
+
skippedFiles.push(entry.path);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const target = path.resolve(options.cwd, entry.path);
|
|
42
|
+
const prior = entry.exists ? fs.readFileSync(target) : undefined;
|
|
43
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
44
|
+
fs.writeFileSync(target, entry.content);
|
|
45
|
+
rollbacks.push({ path: target, prior });
|
|
46
|
+
if (entry.exists)
|
|
47
|
+
modifiedFiles.push(entry.path);
|
|
48
|
+
else
|
|
49
|
+
createdFiles.push(entry.path);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
rollback(rollbacks);
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
return { status: 'written', createdFiles, modifiedFiles, skippedFiles, warnings: [...warnings] };
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Undo in reverse, and never throw: the caller is already reporting a failure,
|
|
60
|
+
* and a rollback error on top of it buries the one that matters. What could not
|
|
61
|
+
* be undone is named on stderr instead.
|
|
62
|
+
*/
|
|
63
|
+
function rollback(rollbacks) {
|
|
64
|
+
for (const entry of [...rollbacks].reverse()) {
|
|
65
|
+
try {
|
|
66
|
+
if (entry.prior === undefined)
|
|
67
|
+
fs.rmSync(entry.path, { force: true });
|
|
68
|
+
else
|
|
69
|
+
fs.writeFileSync(entry.path, entry.prior);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
73
|
+
process.stderr.write(` rollback: failed to restore ${entry.path}: ${detail}\n`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The outcome as the JSON object `--json` prints, kept in one place because it
|
|
79
|
+
* is a contract with another package rather than a debug dump: `ream-mcp` reads
|
|
80
|
+
* the last line of stdout and dispatches on which shape it is.
|
|
81
|
+
*/
|
|
82
|
+
export function outcomePayload(outcome) {
|
|
83
|
+
if (outcome.status === 'planned') {
|
|
84
|
+
return { files: outcome.files, warnings: outcome.warnings };
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
createdFiles: outcome.createdFiles,
|
|
88
|
+
modifiedFiles: outcome.modifiedFiles,
|
|
89
|
+
skippedFiles: outcome.skippedFiles,
|
|
90
|
+
warnings: outcome.warnings,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=flush.js.map
|
|
@@ -0,0 +1 @@
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