@dudousxd/nestjs-codegen 0.29.1 → 0.30.0
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/CHANGELOG.md +16 -0
- package/dist/cli/main.cjs +7 -8
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.js +7 -8
- package/dist/cli/main.js.map +1 -1
- package/dist/extension/index.d.cts +1 -1
- package/dist/extension/index.d.ts +1 -1
- package/dist/{index-Dc4s883u.d.cts → index-D4Blt-RT.d.cts} +1 -13
- package/dist/{index-Dc4s883u.d.ts → index-D4Blt-RT.d.ts} +1 -13
- package/dist/index.cjs +7 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -21
- package/dist/index.js.map +1 -1
- package/dist/nest/index.cjs +7 -8
- package/dist/nest/index.cjs.map +1 -1
- package/dist/nest/index.d.cts +1 -1
- package/dist/nest/index.d.ts +1 -1
- package/dist/nest/index.js +7 -8
- package/dist/nest/index.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { l as ApiClientLayer, m as ApiHeaderContribution, n as ApiModuleDeps, C as CodegenExtension, o as EmittedFile, E as ExtensionContext, L as LeafModel, p as RequestModel, q as RequestShape, s as defineExtension, t as requestShape } from '../index-D4Blt-RT.cjs';
|
|
2
2
|
import 'ts-morph';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { l as ApiClientLayer, m as ApiHeaderContribution, n as ApiModuleDeps, C as CodegenExtension, o as EmittedFile, E as ExtensionContext, L as LeafModel, p as RequestModel, q as RequestShape, s as defineExtension, t as requestShape } from '../index-D4Blt-RT.js';
|
|
2
2
|
import 'ts-morph';
|
|
@@ -261,12 +261,6 @@ interface UserConfig {
|
|
|
261
261
|
/** Debounce delay in ms before re-running route discovery. Default: `500` */
|
|
262
262
|
debounceMs?: number;
|
|
263
263
|
};
|
|
264
|
-
/**
|
|
265
|
-
* @deprecated Has no effect: discovery never read it. For several Inertia apps use
|
|
266
|
-
* `pages.scopes`; for several controller sets use one `contracts.glob` (brace/extglob).
|
|
267
|
-
* A config that sets it gets a warning.
|
|
268
|
-
*/
|
|
269
|
-
scopes?: Record<string, ScopeConfig>;
|
|
270
264
|
codegen?: {
|
|
271
265
|
outDir?: string;
|
|
272
266
|
cwd?: string;
|
|
@@ -362,11 +356,6 @@ interface UserConfig {
|
|
|
362
356
|
*/
|
|
363
357
|
driftGuard?: boolean;
|
|
364
358
|
}
|
|
365
|
-
/** @deprecated See `UserConfig.scopes`. */
|
|
366
|
-
interface ScopeConfig {
|
|
367
|
-
glob: string;
|
|
368
|
-
prefix?: string;
|
|
369
|
-
}
|
|
370
359
|
/** How a page file's path (relative to its glob's static base) becomes its component name. */
|
|
371
360
|
type PageNameStrategy = 'relative-no-ext' | 'kebab' | ((path: string) => string);
|
|
372
361
|
/** One more Inertia app (an `InertiaModule.forFeature({ scope })`) — see `pages.scopes`. */
|
|
@@ -430,7 +419,6 @@ interface ResolvedConfig {
|
|
|
430
419
|
validation: ValidationAdapter;
|
|
431
420
|
pages: ResolvedPagesConfig | null;
|
|
432
421
|
contracts: ResolvedContractsConfig;
|
|
433
|
-
scopes: Record<string, ScopeConfig>;
|
|
434
422
|
codegen: ResolvedCodegenConfig;
|
|
435
423
|
app: ResolvedAppConfig | null;
|
|
436
424
|
fetcher: {
|
|
@@ -877,4 +865,4 @@ declare function requestShape(route: RouteDescriptor): RequestShape;
|
|
|
877
865
|
/** Identity helper for authoring extensions with full type inference. */
|
|
878
866
|
declare function defineExtension(ext: CodegenExtension): CodegenExtension;
|
|
879
867
|
|
|
880
|
-
export { type AdapterUsage as A, type CodegenExtension as C, type ExtensionContext as E, type LeafModel as L, type NumberCheck as N, type ResolvedConfig as R, type SchemaNode as S, type TypeRef as T, type UserConfig as U, type ValidationAdapter as V, type RouteDescriptor as a, type RenderContext as b, type SchemaModule as c, type RenderedModule as d, type ResolvedFormsConfig as e, type SerializationMode as f, type ContractDescriptor as g, type ContractSource as h, type ControllerRef as i, type
|
|
868
|
+
export { type AdapterUsage as A, type CodegenExtension as C, type ExtensionContext as E, type LeafModel as L, type NumberCheck as N, type ResolvedConfig as R, type SchemaNode as S, type TypeRef as T, type UserConfig as U, type ValidationAdapter as V, type RouteDescriptor as a, type RenderContext as b, type SchemaModule as c, type RenderedModule as d, type ResolvedFormsConfig as e, type SerializationMode as f, type ContractDescriptor as g, type ContractSource as h, type ControllerRef as i, type StringCheck as j, type ValidationOption as k, type ApiClientLayer as l, type ApiHeaderContribution as m, type ApiModuleDeps as n, type EmittedFile as o, type RequestModel as p, type RequestShape as q, resolveAdapter as r, defineExtension as s, requestShape as t };
|
|
@@ -261,12 +261,6 @@ interface UserConfig {
|
|
|
261
261
|
/** Debounce delay in ms before re-running route discovery. Default: `500` */
|
|
262
262
|
debounceMs?: number;
|
|
263
263
|
};
|
|
264
|
-
/**
|
|
265
|
-
* @deprecated Has no effect: discovery never read it. For several Inertia apps use
|
|
266
|
-
* `pages.scopes`; for several controller sets use one `contracts.glob` (brace/extglob).
|
|
267
|
-
* A config that sets it gets a warning.
|
|
268
|
-
*/
|
|
269
|
-
scopes?: Record<string, ScopeConfig>;
|
|
270
264
|
codegen?: {
|
|
271
265
|
outDir?: string;
|
|
272
266
|
cwd?: string;
|
|
@@ -362,11 +356,6 @@ interface UserConfig {
|
|
|
362
356
|
*/
|
|
363
357
|
driftGuard?: boolean;
|
|
364
358
|
}
|
|
365
|
-
/** @deprecated See `UserConfig.scopes`. */
|
|
366
|
-
interface ScopeConfig {
|
|
367
|
-
glob: string;
|
|
368
|
-
prefix?: string;
|
|
369
|
-
}
|
|
370
359
|
/** How a page file's path (relative to its glob's static base) becomes its component name. */
|
|
371
360
|
type PageNameStrategy = 'relative-no-ext' | 'kebab' | ((path: string) => string);
|
|
372
361
|
/** One more Inertia app (an `InertiaModule.forFeature({ scope })`) — see `pages.scopes`. */
|
|
@@ -430,7 +419,6 @@ interface ResolvedConfig {
|
|
|
430
419
|
validation: ValidationAdapter;
|
|
431
420
|
pages: ResolvedPagesConfig | null;
|
|
432
421
|
contracts: ResolvedContractsConfig;
|
|
433
|
-
scopes: Record<string, ScopeConfig>;
|
|
434
422
|
codegen: ResolvedCodegenConfig;
|
|
435
423
|
app: ResolvedAppConfig | null;
|
|
436
424
|
fetcher: {
|
|
@@ -877,4 +865,4 @@ declare function requestShape(route: RouteDescriptor): RequestShape;
|
|
|
877
865
|
/** Identity helper for authoring extensions with full type inference. */
|
|
878
866
|
declare function defineExtension(ext: CodegenExtension): CodegenExtension;
|
|
879
867
|
|
|
880
|
-
export { type AdapterUsage as A, type CodegenExtension as C, type ExtensionContext as E, type LeafModel as L, type NumberCheck as N, type ResolvedConfig as R, type SchemaNode as S, type TypeRef as T, type UserConfig as U, type ValidationAdapter as V, type RouteDescriptor as a, type RenderContext as b, type SchemaModule as c, type RenderedModule as d, type ResolvedFormsConfig as e, type SerializationMode as f, type ContractDescriptor as g, type ContractSource as h, type ControllerRef as i, type
|
|
868
|
+
export { type AdapterUsage as A, type CodegenExtension as C, type ExtensionContext as E, type LeafModel as L, type NumberCheck as N, type ResolvedConfig as R, type SchemaNode as S, type TypeRef as T, type UserConfig as U, type ValidationAdapter as V, type RouteDescriptor as a, type RenderContext as b, type SchemaModule as c, type RenderedModule as d, type ResolvedFormsConfig as e, type SerializationMode as f, type ContractDescriptor as g, type ContractSource as h, type ControllerRef as i, type StringCheck as j, type ValidationOption as k, type ApiClientLayer as l, type ApiHeaderContribution as m, type ApiModuleDeps as n, type EmittedFile as o, type RequestModel as p, type RequestShape as q, resolveAdapter as r, defineExtension as s, requestShape as t };
|
package/dist/index.cjs
CHANGED
|
@@ -168,11 +168,6 @@ function validateUserConfig(userConfig) {
|
|
|
168
168
|
);
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
if (userConfig.scopes && Object.keys(userConfig.scopes).length > 0) {
|
|
172
|
-
console.warn(
|
|
173
|
-
"[nestjs-codegen] The top-level `scopes` option has no effect and is deprecated. For several Inertia apps use `pages.scopes` (one entry per InertiaModule.forFeature scope); for several controller sets use one `contracts.glob` (e.g. a brace glob)."
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
171
|
}
|
|
177
172
|
function isGlobInput(value) {
|
|
178
173
|
if (typeof value === "string") return true;
|
|
@@ -220,7 +215,6 @@ function applyDefaults(userConfig, cwd) {
|
|
|
220
215
|
glob: userConfig.contracts?.glob ?? "src/**/*.controller.ts",
|
|
221
216
|
debounceMs: userConfig.contracts?.debounceMs ?? 500
|
|
222
217
|
},
|
|
223
|
-
scopes: userConfig.scopes ?? {},
|
|
224
218
|
codegen: {
|
|
225
219
|
outDir,
|
|
226
220
|
cwd: resolvedCwd
|
|
@@ -6060,7 +6054,7 @@ async function generate(config, inputRoutes = [], entryPoint = "cli") {
|
|
|
6060
6054
|
}
|
|
6061
6055
|
const configHash = computeConfigHash(config);
|
|
6062
6056
|
const configKeyHashes = computeConfigKeyHashes(config);
|
|
6063
|
-
if (config.driftGuard && manifest?.entryPoint && manifest.entryPoint !== entryPoint && manifest.configHash && manifest.configHash !== configHash) {
|
|
6057
|
+
if (config.driftGuard && manifest?.version === VERSION && manifest?.entryPoint && manifest.entryPoint !== entryPoint && manifest.configHash && manifest.configHash !== configHash) {
|
|
6064
6058
|
throw new DriftGuardError(
|
|
6065
6059
|
driftGuardMessage(
|
|
6066
6060
|
config.codegen.outDir,
|
|
@@ -6361,6 +6355,11 @@ async function watch(config, onChange, options = {}) {
|
|
|
6361
6355
|
trackedWatcher.on("add", (p) => scheduleContractsRegenerate(p, true));
|
|
6362
6356
|
trackedWatcher.on("change", (p) => scheduleContractsRegenerate(p));
|
|
6363
6357
|
trackedWatcher.on("unlink", (p) => scheduleContractsRegenerate(p, true));
|
|
6358
|
+
await Promise.all(
|
|
6359
|
+
[pagesWatcher, contractsWatcher, formsWatcher].map(
|
|
6360
|
+
(w) => new Promise((resolveReady) => w.once("ready", () => resolveReady()))
|
|
6361
|
+
)
|
|
6362
|
+
);
|
|
6364
6363
|
return {
|
|
6365
6364
|
close: async () => {
|
|
6366
6365
|
if (pagesDebounceTimer !== void 0) {
|
|
@@ -6476,11 +6475,6 @@ var DEFAULT_KIT_DIRS = [
|
|
|
6476
6475
|
"app/components/ui",
|
|
6477
6476
|
"components/ui"
|
|
6478
6477
|
];
|
|
6479
|
-
var LEGACY_OPTIONS = {
|
|
6480
|
-
entry: "`entry: X` is now `components: X`",
|
|
6481
|
-
include: "`include: G` is now `components: G` (globs, files, directories or packages)",
|
|
6482
|
-
css: "`css: G` is now `styles: G` (the app's style entry files)"
|
|
6483
|
-
};
|
|
6484
6478
|
var MIN_CORE = "0.53.0";
|
|
6485
6479
|
async function loadKitModule(specifier = GENUI_KIT_MODULE) {
|
|
6486
6480
|
let mod;
|
|
@@ -6547,14 +6541,6 @@ function resolveKitFilesLocally(root, options) {
|
|
|
6547
6541
|
return { files: [...new Set(files)].sort(), dirs: [...dirs] };
|
|
6548
6542
|
}
|
|
6549
6543
|
function genuiSandboxKit(options = {}) {
|
|
6550
|
-
const legacy = Object.keys(LEGACY_OPTIONS).filter(
|
|
6551
|
-
(key) => options[key] !== void 0
|
|
6552
|
-
);
|
|
6553
|
-
if (legacy.length > 0) {
|
|
6554
|
-
throw new CodegenError(
|
|
6555
|
-
`genuiSandboxKit(): ${legacy.map((key) => `\`${key}\``).join(", ")} ${legacy.length > 1 ? "were" : "was"} removed \u2014 ${legacy.map((key) => LEGACY_OPTIONS[key]).join("; ")}. The options are now the agent's Vite plugin's: components, styles, wrapper, stylesDocs.`
|
|
6556
|
-
);
|
|
6557
|
-
}
|
|
6558
6544
|
const output = options.output ?? DEFAULT_SANDBOX_KIT_OUTPUT;
|
|
6559
6545
|
const source = {
|
|
6560
6546
|
...options.components !== void 0 ? { components: options.components } : {},
|
|
@@ -6616,7 +6602,7 @@ function genuiSandboxKit(options = {}) {
|
|
|
6616
6602
|
}
|
|
6617
6603
|
|
|
6618
6604
|
// src/index.ts
|
|
6619
|
-
var VERSION = "0.
|
|
6605
|
+
var VERSION = "0.30.0";
|
|
6620
6606
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6621
6607
|
0 && (module.exports = {
|
|
6622
6608
|
CodegenError,
|