@sdk-it/vite 0.48.2 → 0.49.1

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 CHANGED
@@ -8,6 +8,8 @@ Generate a TypeScript SDK during Vite development and builds.
8
8
  npm install --save-dev @sdk-it/vite @sdk-it/spec @sdk-it/typescript
9
9
  ```
10
10
 
11
+ The plugin needs Vite 8.
12
+
11
13
  ## Import an OpenAPI document
12
14
 
13
15
  `sdkIt.imports()` serves an imported OpenAPI document as its SDK, with no SDK on disk:
@@ -27,7 +29,7 @@ const pet = await store.request('GET /pets/{petId}', { petId: 'p1' });
27
29
 
28
30
  It handles imports that end with `.openapi.yaml`, and `.openapi` for a JSON document. `@sdk-it/content-mapper` renders the module, the same way it gives the import its types in `tsc` and the editor (see its README for the tsconfig `contentMappers` entry), so the types and the running code come from one render. The module's id is the document's path with `.ts` added, so Vite strips its types, in dev and in a build. An edit to the document, or to a file it references through `$ref`, reloads the module. A document referenced over http(s) is read each time the module loads, and is not watched. A document that does not render fails the import with its first diagnostic, at its line and column.
29
31
 
30
- On App Store Connect (1,300 operations, a 3.5 MB module) a dev reload takes about 2 to 4 s. Vite 8.3's dev server holds about 30 MB more after each server-side (`ssrLoadModule`) reload of that module, as it does for a plain `.ts` file of the same size. [Import an OpenAPI document as a module](../../docs/recipes/import-openapi-document.md) sets up the types and Node too.
32
+ On App Store Connect (1,300 operations, a 3.5 MB module) a dev reload takes about 2 to 4 s. The dev server's heap stays flat across reloads: Vite's SSR runner compiles each module from a string, which V8 keeps in its eval cache, and the module opts out of that cache. [Import an OpenAPI document as a module](../../docs/recipes/import-openapi-document.md) sets up the types and Node too.
31
33
 
32
34
  ## Use an OpenAPI file
33
35
 
@@ -1 +1 @@
1
- {"version":3,"file":"document-imports.d.ts","sources":["../src/document-imports.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAiB,MAAM,MAAM,CAAC;AAalD;;;;;GAKG;AACH,qBAAa,eAAe;IAC1B,QAAQ,IAAI,MAAM,CA2CjB;CACF"}
1
+ {"version":3,"file":"document-imports.d.ts","sources":["../src/document-imports.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAgC,MAAM,MAAM,CAAC;AAajE;;;;;GAKG;AACH,qBAAa,eAAe;IAC1B,QAAQ,IAAI,MAAM,CAmCjB;CACF"}
package/dist/index.js CHANGED
@@ -128,6 +128,17 @@ var DocumentImports = class {
128
128
  return {
129
129
  name: "sdk-it:imports",
130
130
  enforce: "pre",
131
+ // Vite's dependency scan bundles the app with Rolldown, which calls this
132
+ // plugin's resolveId but not its load, and reads the module from disk.
133
+ // A plugin in optimizeDeps.rolldownOptions.plugins loads it there, so
134
+ // the scan follows the SDK to the packages it imports.
135
+ configEnvironment: () => ({
136
+ optimizeDeps: {
137
+ rolldownOptions: {
138
+ plugins: [{ name: "sdk-it:imports:scan", load: loadDocument }]
139
+ }
140
+ }
141
+ }),
131
142
  async resolveId(source, importer, options) {
132
143
  if (!isDocument(source)) return null;
133
144
  const resolved = await this.resolve(source, importer, {
@@ -136,24 +147,7 @@ var DocumentImports = class {
136
147
  });
137
148
  return resolved && !resolved.external ? `${resolved.id}.ts` : null;
138
149
  },
139
- async load(id) {
140
- const file = id.slice(0, -".ts".length);
141
- if (!id.endsWith(".ts") || !isDocument(file)) return null;
142
- const content = await readFile(file, "utf8");
143
- const document = await renderDocument(file, content);
144
- for (const uri of document.documents) {
145
- if (uri.startsWith("file:")) this.addWatchFile(fileURLToPath2(uri));
146
- }
147
- const fail = (problem) => this.error({
148
- message: problem.message,
149
- id: file,
150
- loc: { file, ...position(content, problem.range.start) }
151
- });
152
- if (document.kind === "failed") return fail(document.diagnostics[0]);
153
- const [yamlError] = document.diagnostics;
154
- if (yamlError) return fail(yamlError);
155
- return document.text;
156
- },
150
+ load: loadDocument,
157
151
  // A change to a file the document references reloads the module through
158
152
  // addWatchFile, but the module's id is not the document's own path, so
159
153
  // Vite does not tie a change of the document itself to it.
@@ -167,6 +161,26 @@ var DocumentImports = class {
167
161
  };
168
162
  }
169
163
  };
164
+ async function loadDocument(id) {
165
+ const file = id.slice(0, -".ts".length);
166
+ if (!id.endsWith(".ts") || !isDocument(file)) return null;
167
+ const content = await readFile(file, "utf8");
168
+ const document = await renderDocument(file, content);
169
+ for (const uri of document.documents) {
170
+ if (uri.startsWith("file:")) this.addWatchFile(fileURLToPath2(uri));
171
+ }
172
+ const fail = (problem) => this.error({
173
+ message: problem.message,
174
+ id: file,
175
+ loc: { file, ...position(content, problem.range.start) }
176
+ });
177
+ if (document.kind === "failed") return fail(document.diagnostics[0]);
178
+ const [yamlError] = document.diagnostics;
179
+ if (yamlError) return fail(yamlError);
180
+ return `${document.text}
181
+ if (0) (() => {})\`\`;
182
+ `;
183
+ }
170
184
  function position(text, index) {
171
185
  const before = text.slice(0, index);
172
186
  const lineStart = before.lastIndexOf("\n") + 1;
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/disk-sdk.ts", "../src/output-folder.ts", "../src/document-imports.ts", "../src/project.ts", "../src/spec-source.ts", "../src/index.ts"],
4
- "sourcesContent": ["import { Future } from '@zukhruf/async';\nimport crypto from 'node:crypto';\nimport { fileURLToPath } from 'node:url';\nimport { styleText } from 'node:util';\nimport type { OpenAPIObject } from 'openapi3-ts/oas31';\nimport { type FSWatcher, type Plugin, type Rollup, normalizePath } from 'vite';\n\nimport { generate } from '@sdk-it/typescript';\n\nimport { OutputFolder } from './output-folder.ts';\nimport type { ConfiguredSpec, SpecSource } from './spec-source.ts';\n\nexport type DiskSdkSettings = Parameters<typeof generate>[1];\n\nconst sdkit = styleText('blue', 'SDKIT');\n\n/**\n * Generates an SDK into a folder on disk at the start of a build or a dev\n * server, and again in dev when a local document of the spec changes.\n */\nexport class DiskSdk {\n readonly #source: SpecSource;\n readonly #settings: DiskSdkSettings;\n readonly #output: OutputFolder;\n readonly #configured = new Future<ConfiguredSpec>();\n /** The dev server's watcher; a build never has one. */\n readonly #watcher = new Future<FSWatcher>();\n /** Every local file the spec was read from; an edit to any of them regenerates. */\n #watched = new Set<string>();\n #loads = 0;\n\n constructor(source: SpecSource, settings: DiskSdkSettings) {\n this.#source = source;\n this.#settings = settings;\n this.#output = new OutputFolder(settings.output);\n }\n\n toPlugin(): Plugin {\n const configure = async (root: string) => {\n try {\n this.#configured.resolve(await this.#source.configure(root));\n } catch (error) {\n this.#configured.reject(error);\n throw error;\n }\n };\n const serve = async (watcher: FSWatcher) => {\n this.#watcher.resolve(watcher);\n return (await this.#configured.wait()).watchPath;\n };\n const generate = (context: Rollup.PluginContext) => this.#generate(context);\n const watches = (id: string) => this.#watched.has(normalizePath(id));\n return {\n name: 'sdk-it',\n async configResolved(config) {\n await configure(config.root);\n },\n async configureServer(server) {\n const watchPath = await serve(server.watcher);\n if (watchPath) {\n console.log(`${sdkit}: Watching for spec changes in`, watchPath);\n }\n },\n async buildStart() {\n await generate(this);\n },\n watchChange(id, { event }) {\n if (event === 'delete' || !watches(id)) return;\n console.log(`${sdkit}: OpenAPI spec changed`, id);\n // A half-saved file fails to load; the next save tries again.\n generate(this).catch((error: unknown) =>\n console.error(\n `${styleText('red', 'SDKIT', { stream: process.stderr })}: SDK generation failed.`,\n error,\n ),\n );\n },\n };\n }\n\n async #generate(context: Rollup.PluginContext) {\n const load = ++this.#loads;\n const { spec, documents } = await (await this.#configured.wait()).load();\n if (load === this.#loads) this.#watch(context, documents);\n return this.#output.generate(hashSpec(spec), async () => {\n console.log(`${sdkit}: Generating SDK.`);\n await generate(spec, this.#settings);\n console.log(`${sdkit}: SDK generated successfully.`);\n });\n }\n\n #watch(context: Rollup.PluginContext, documents: readonly string[]) {\n this.#watched = new Set(\n documents\n .filter((document) => document.startsWith('file:'))\n .map((document) => normalizePath(fileURLToPath(document))),\n );\n for (const file of this.#watched) {\n context.addWatchFile(file);\n // Vite watches a file outside its root only when the file exists\n // (ensureWatchedFile), so a referenced file that does not exist yet is\n // added to the dev server's watcher here, and creating it regenerates.\n void this.#watcher.wait().then((watcher) => watcher.add(file));\n }\n }\n}\n\nfunction hashSpec(spec: OpenAPIObject): string {\n return crypto.hash('sha256', JSON.stringify(spec));\n}\n", "import { Mutex } from '@zukhruf/mutex';\nimport { SqliteStore } from '@zukhruf/mutex/sqlite';\nimport { tmpdir } from 'node:os';\nimport { join, resolve } from 'node:path';\n\n/**\n * The folder an SDK is generated into. Every process on the host that\n * generates into it, such as a dev server and a build at once, holds one lock\n * for it, so no two generations write its files at the same time. A process\n * does not generate again the spec it last wrote there.\n */\nexport class OutputFolder {\n static readonly #mutex = new Mutex(\n new SqliteStore(join(tmpdir(), 'sdk-it', 'output-locks'), {\n clock: globalThis,\n }),\n );\n /** The hash of the spec this process last wrote into each folder. */\n static readonly #written = new Map<string, string>();\n readonly #path: string;\n\n constructor(output: string) {\n this.#path = resolve(output);\n }\n\n generate(hash: string, generate: () => Promise<void>): Promise<void> {\n return OutputFolder.#mutex.acquire(this.#path, async () => {\n if (OutputFolder.#written.get(this.#path) === hash) return;\n await generate();\n OutputFolder.#written.set(this.#path, hash);\n });\n }\n}\n", "import { readFile } from 'node:fs/promises';\nimport { fileURLToPath } from 'node:url';\nimport { type Plugin, normalizePath } from 'vite';\n\nimport {\n type DocumentDiagnostic,\n renderDocument,\n} from '@sdk-it/content-mapper';\n\n/** The extensions an imported OpenAPI document ends with: YAML, and JSON under a name TypeScript accepts for a mapped file. */\nconst extensions = ['.openapi.yaml', '.openapi'];\n\nconst isDocument = (path: string) =>\n extensions.some((extension) => path.endsWith(extension));\n\n/**\n * Serves an imported OpenAPI document as its SDK module, rendered by\n * `@sdk-it/content-mapper` as the TypeScript content mapper renders it:\n * `import { store } from './store.openapi.yaml'`. The module's id is the\n * document's path with `.ts` added, so Vite strips its types.\n */\nexport class DocumentImports {\n toPlugin(): Plugin {\n return {\n name: 'sdk-it:imports',\n enforce: 'pre',\n async resolveId(source, importer, options) {\n if (!isDocument(source)) return null;\n const resolved = await this.resolve(source, importer, {\n ...options,\n skipSelf: true,\n });\n return resolved && !resolved.external ? `${resolved.id}.ts` : null;\n },\n async load(id) {\n const file = id.slice(0, -'.ts'.length);\n if (!id.endsWith('.ts') || !isDocument(file)) return null;\n const content = await readFile(file, 'utf8');\n const document = await renderDocument(file, content);\n for (const uri of document.documents) {\n if (uri.startsWith('file:')) this.addWatchFile(fileURLToPath(uri));\n }\n const fail = (problem: DocumentDiagnostic) =>\n this.error({\n message: problem.message,\n id: file,\n loc: { file, ...position(content, problem.range.start) },\n });\n if (document.kind === 'failed') return fail(document.diagnostics[0]);\n // A document with YAML errors can still render; it does not run until it is fixed.\n const [yamlError] = document.diagnostics;\n if (yamlError) return fail(yamlError);\n return document.text;\n },\n // A change to a file the document references reloads the module through\n // addWatchFile, but the module's id is not the document's own path, so\n // Vite does not tie a change of the document itself to it.\n hotUpdate({ file, modules }) {\n if (!isDocument(file)) return;\n const module = this.environment.moduleGraph.getModuleById(\n `${normalizePath(file)}.ts`,\n );\n return module ? [...modules, module] : modules;\n },\n };\n }\n}\n\n/** The line (from 1) and column (from 0) of `index` in `text`, as Rollup reports a location. */\nfunction position(text: string, index: number) {\n const before = text.slice(0, index);\n const lineStart = before.lastIndexOf('\\n') + 1;\n return { line: before.split('\\n').length, column: index - lineStart };\n}\n", "import type { Plugin } from 'vite';\n\nexport interface ProjectSdkOptions {\n /** The project config file; the CLI finds it from the Vite root without one. */\n config?: string;\n}\n\n/** Generates every client of an sdk-it project, as `sdk-it generate` does. */\nexport class ProjectSdk {\n readonly #options: ProjectSdkOptions;\n #root = process.cwd();\n\n constructor(options: ProjectSdkOptions) {\n this.#options = options;\n }\n\n toPlugin(): Plugin {\n const configure = (root: string) => {\n this.#root = root;\n };\n const generate = () => this.#generate();\n return {\n name: 'sdk-it',\n configResolved(config) {\n configure(config.root);\n },\n async configureServer() {\n await generate();\n },\n async buildStart() {\n await generate();\n },\n };\n }\n\n async #generate() {\n const { generateProject, loadProjectConfig } = await import('@sdk-it/cli');\n const config = await loadProjectConfig({\n cwd: this.#root,\n config: this.#options.config,\n });\n await generateProject(config);\n }\n}\n", "import { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { OpenAPIObject } from 'openapi3-ts/oas31';\n\nimport { loadSpec } from '@sdk-it/spec';\n\n/** A spec read for one generation, and the URI of every document it was read from. */\nexport interface LoadedSpec {\n spec: OpenAPIObject;\n documents: readonly string[];\n}\n\n/** A source bound to a Vite root, ready to load. */\nexport interface ConfiguredSpec {\n /** The local file the spec starts from, when it is one. */\n readonly watchPath: string | undefined;\n load(): Promise<LoadedSpec>;\n}\n\n/** Where the spec of a generated SDK comes from. */\nexport interface SpecSource {\n configure(root: string): Promise<ConfiguredSpec>;\n}\n\n/** A spec at a path relative to the Vite root, or at a URL. */\nexport class FileSpecSource implements SpecSource {\n readonly #location: string;\n\n constructor(location: string) {\n this.#location = location;\n }\n\n async configure(root: string): Promise<ConfiguredSpec> {\n const location = this.#location;\n if (!startsWithProtocol(location)) {\n const path = join(root, location);\n return { watchPath: path, load: () => loadSpec(path) };\n }\n return {\n watchPath: location.startsWith('file:')\n ? fileURLToPath(location)\n : undefined,\n load: () => loadSpec(location),\n };\n }\n}\n\n/** A spec the Vite config holds as an object. */\nexport class DocumentSpecSource implements SpecSource {\n readonly #document: OpenAPIObject;\n\n constructor(document: OpenAPIObject) {\n this.#document = document;\n }\n\n async configure(): Promise<ConfiguredSpec> {\n return {\n watchPath: undefined,\n load: async () => ({\n spec: structuredClone(this.#document),\n documents: [],\n }),\n };\n }\n}\n\n/** A spec a function gives once Vite resolves its config: a location or an object. */\nexport class LazySpecSource implements SpecSource {\n readonly #resolve: () =>\n string | OpenAPIObject | Promise<string | OpenAPIObject>;\n\n constructor(\n resolve: () => string | OpenAPIObject | Promise<string | OpenAPIObject>,\n ) {\n this.#resolve = resolve;\n }\n\n async configure(root: string): Promise<ConfiguredSpec> {\n const resolved = await this.#resolve();\n const source =\n typeof resolved === 'string'\n ? new FileSpecSource(resolved)\n : new DocumentSpecSource(resolved);\n return source.configure(root);\n }\n}\n\nfunction startsWithProtocol(url: string): boolean {\n return /^[a-zA-Z][a-zA-Z0-9+\\-.]*:\\/\\//.test(url);\n}\n", "import type { OpenAPIObject } from 'openapi3-ts/oas31';\nimport type { Plugin } from 'vite';\n\nimport { DiskSdk, type DiskSdkSettings } from './disk-sdk.ts';\nimport { DocumentImports } from './document-imports.ts';\nimport { ProjectSdk, type ProjectSdkOptions } from './project.ts';\nimport {\n DocumentSpecSource,\n FileSpecSource,\n LazySpecSource,\n} from './spec-source.ts';\n\nexport type { DiskSdkSettings } from './disk-sdk.ts';\nexport type { ProjectSdkOptions } from './project.ts';\n\n/** The sdk-it Vite plugins, one factory for each way an SDK comes to the app. */\nexport const sdkIt = {\n /** Generates an SDK on disk from the spec at `location`: a path relative to the Vite root, or a URL. */\n file(location: string, settings: DiskSdkSettings): Plugin {\n return new DiskSdk(new FileSpecSource(location), settings).toPlugin();\n },\n /** Generates an SDK on disk from a spec object. */\n document(document: OpenAPIObject, settings: DiskSdkSettings): Plugin {\n return new DiskSdk(new DocumentSpecSource(document), settings).toPlugin();\n },\n /** Generates an SDK on disk from the location or object `resolve` gives once Vite resolves its config. */\n lazy(\n resolve: () => string | OpenAPIObject | Promise<string | OpenAPIObject>,\n settings: DiskSdkSettings,\n ): Plugin {\n return new DiskSdk(new LazySpecSource(resolve), settings).toPlugin();\n },\n /** Generates every client of an sdk-it project config. */\n project(options: ProjectSdkOptions): Plugin {\n return new ProjectSdk(options).toPlugin();\n },\n /** Serves `import { store } from './store.openapi.yaml'` as the document's SDK, with no SDK on disk. */\n imports(): Plugin {\n return new DocumentImports().toPlugin();\n },\n};\n\nexport default sdkIt;\n"],
5
- "mappings": ";AAAA,SAAS,cAAc;AACvB,OAAO,YAAY;AACnB,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAE1B,SAAmD,qBAAqB;AAExE,SAAS,gBAAgB;;;AC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AAN,MAA2C;AAAA,EACvC;AAAA,EAGT,YACEC,UACA;AACA,SAAK,WAAWA;AAAA,EAClB;AAAA,EAEA,MAAM,UAAU,MAAuC;AACrD,UAAM,WAAW,MAAM,KAAK,SAAS;AACrC,UAAM,SACJ,OAAO,aAAa,WAChB,IAAI,eAAe,QAAQ,IAC3B,IAAI,mBAAmB,QAAQ;AACrC,WAAO,OAAO,UAAU,IAAI;AAAA,EAC9B;AACF;AAEA,SAAS,mBAAmB,KAAsB;AAChD,SAAO,iCAAiC,KAAK,GAAG;AAClD;;;ACzEO,IAAM,QAAQ;AAAA;AAAA,EAEnB,KAAK,UAAkB,UAAmC;AACxD,WAAO,IAAI,QAAQ,IAAI,eAAe,QAAQ,GAAG,QAAQ,EAAE,SAAS;AAAA,EACtE;AAAA;AAAA,EAEA,SAAS,UAAyB,UAAmC;AACnE,WAAO,IAAI,QAAQ,IAAI,mBAAmB,QAAQ,GAAG,QAAQ,EAAE,SAAS;AAAA,EAC1E;AAAA;AAAA,EAEA,KACEC,UACA,UACQ;AACR,WAAO,IAAI,QAAQ,IAAI,eAAeA,QAAO,GAAG,QAAQ,EAAE,SAAS;AAAA,EACrE;AAAA;AAAA,EAEA,QAAQ,SAAoC;AAC1C,WAAO,IAAI,WAAW,OAAO,EAAE,SAAS;AAAA,EAC1C;AAAA;AAAA,EAEA,UAAkB;AAChB,WAAO,IAAI,gBAAgB,EAAE,SAAS;AAAA,EACxC;AACF;AAEA,IAAO,gBAAQ;",
4
+ "sourcesContent": ["import { Future } from '@zukhruf/async';\nimport crypto from 'node:crypto';\nimport { fileURLToPath } from 'node:url';\nimport { styleText } from 'node:util';\nimport type { OpenAPIObject } from 'openapi3-ts/oas31';\nimport { type FSWatcher, type Plugin, type Rollup, normalizePath } from 'vite';\n\nimport { generate } from '@sdk-it/typescript';\n\nimport { OutputFolder } from './output-folder.ts';\nimport type { ConfiguredSpec, SpecSource } from './spec-source.ts';\n\nexport type DiskSdkSettings = Parameters<typeof generate>[1];\n\nconst sdkit = styleText('blue', 'SDKIT');\n\n/**\n * Generates an SDK into a folder on disk at the start of a build or a dev\n * server, and again in dev when a local document of the spec changes.\n */\nexport class DiskSdk {\n readonly #source: SpecSource;\n readonly #settings: DiskSdkSettings;\n readonly #output: OutputFolder;\n readonly #configured = new Future<ConfiguredSpec>();\n /** The dev server's watcher; a build never has one. */\n readonly #watcher = new Future<FSWatcher>();\n /** Every local file the spec was read from; an edit to any of them regenerates. */\n #watched = new Set<string>();\n #loads = 0;\n\n constructor(source: SpecSource, settings: DiskSdkSettings) {\n this.#source = source;\n this.#settings = settings;\n this.#output = new OutputFolder(settings.output);\n }\n\n toPlugin(): Plugin {\n const configure = async (root: string) => {\n try {\n this.#configured.resolve(await this.#source.configure(root));\n } catch (error) {\n this.#configured.reject(error);\n throw error;\n }\n };\n const serve = async (watcher: FSWatcher) => {\n this.#watcher.resolve(watcher);\n return (await this.#configured.wait()).watchPath;\n };\n const generate = (context: Rollup.PluginContext) => this.#generate(context);\n const watches = (id: string) => this.#watched.has(normalizePath(id));\n return {\n name: 'sdk-it',\n async configResolved(config) {\n await configure(config.root);\n },\n async configureServer(server) {\n const watchPath = await serve(server.watcher);\n if (watchPath) {\n console.log(`${sdkit}: Watching for spec changes in`, watchPath);\n }\n },\n async buildStart() {\n await generate(this);\n },\n watchChange(id, { event }) {\n if (event === 'delete' || !watches(id)) return;\n console.log(`${sdkit}: OpenAPI spec changed`, id);\n // A half-saved file fails to load; the next save tries again.\n generate(this).catch((error: unknown) =>\n console.error(\n `${styleText('red', 'SDKIT', { stream: process.stderr })}: SDK generation failed.`,\n error,\n ),\n );\n },\n };\n }\n\n async #generate(context: Rollup.PluginContext) {\n const load = ++this.#loads;\n const { spec, documents } = await (await this.#configured.wait()).load();\n if (load === this.#loads) this.#watch(context, documents);\n return this.#output.generate(hashSpec(spec), async () => {\n console.log(`${sdkit}: Generating SDK.`);\n await generate(spec, this.#settings);\n console.log(`${sdkit}: SDK generated successfully.`);\n });\n }\n\n #watch(context: Rollup.PluginContext, documents: readonly string[]) {\n this.#watched = new Set(\n documents\n .filter((document) => document.startsWith('file:'))\n .map((document) => normalizePath(fileURLToPath(document))),\n );\n for (const file of this.#watched) {\n context.addWatchFile(file);\n // Vite watches a file outside its root only when the file exists\n // (ensureWatchedFile), so a referenced file that does not exist yet is\n // added to the dev server's watcher here, and creating it regenerates.\n void this.#watcher.wait().then((watcher) => watcher.add(file));\n }\n }\n}\n\nfunction hashSpec(spec: OpenAPIObject): string {\n return crypto.hash('sha256', JSON.stringify(spec));\n}\n", "import { Mutex } from '@zukhruf/mutex';\nimport { SqliteStore } from '@zukhruf/mutex/sqlite';\nimport { tmpdir } from 'node:os';\nimport { join, resolve } from 'node:path';\n\n/**\n * The folder an SDK is generated into. Every process on the host that\n * generates into it, such as a dev server and a build at once, holds one lock\n * for it, so no two generations write its files at the same time. A process\n * does not generate again the spec it last wrote there.\n */\nexport class OutputFolder {\n static readonly #mutex = new Mutex(\n new SqliteStore(join(tmpdir(), 'sdk-it', 'output-locks'), {\n clock: globalThis,\n }),\n );\n /** The hash of the spec this process last wrote into each folder. */\n static readonly #written = new Map<string, string>();\n readonly #path: string;\n\n constructor(output: string) {\n this.#path = resolve(output);\n }\n\n generate(hash: string, generate: () => Promise<void>): Promise<void> {\n return OutputFolder.#mutex.acquire(this.#path, async () => {\n if (OutputFolder.#written.get(this.#path) === hash) return;\n await generate();\n OutputFolder.#written.set(this.#path, hash);\n });\n }\n}\n", "import { readFile } from 'node:fs/promises';\nimport { fileURLToPath } from 'node:url';\nimport { type Plugin, type Rolldown, normalizePath } from 'vite';\n\nimport {\n type DocumentDiagnostic,\n renderDocument,\n} from '@sdk-it/content-mapper';\n\n/** The extensions an imported OpenAPI document ends with: YAML, and JSON under a name TypeScript accepts for a mapped file. */\nconst extensions = ['.openapi.yaml', '.openapi'];\n\nconst isDocument = (path: string) =>\n extensions.some((extension) => path.endsWith(extension));\n\n/**\n * Serves an imported OpenAPI document as its SDK module, rendered by\n * `@sdk-it/content-mapper` as the TypeScript content mapper renders it:\n * `import { store } from './store.openapi.yaml'`. The module's id is the\n * document's path with `.ts` added, so Vite strips its types.\n */\nexport class DocumentImports {\n toPlugin(): Plugin {\n return {\n name: 'sdk-it:imports',\n enforce: 'pre',\n // Vite's dependency scan bundles the app with Rolldown, which calls this\n // plugin's resolveId but not its load, and reads the module from disk.\n // A plugin in optimizeDeps.rolldownOptions.plugins loads it there, so\n // the scan follows the SDK to the packages it imports.\n configEnvironment: () => ({\n optimizeDeps: {\n rolldownOptions: {\n plugins: [{ name: 'sdk-it:imports:scan', load: loadDocument }],\n },\n },\n }),\n async resolveId(source, importer, options) {\n if (!isDocument(source)) return null;\n const resolved = await this.resolve(source, importer, {\n ...options,\n skipSelf: true,\n });\n return resolved && !resolved.external ? `${resolved.id}.ts` : null;\n },\n load: loadDocument,\n // A change to a file the document references reloads the module through\n // addWatchFile, but the module's id is not the document's own path, so\n // Vite does not tie a change of the document itself to it.\n hotUpdate({ file, modules }) {\n if (!isDocument(file)) return;\n const module = this.environment.moduleGraph.getModuleById(\n `${normalizePath(file)}.ts`,\n );\n return module ? [...modules, module] : modules;\n },\n };\n }\n}\n\n/** Renders the document of the module id `<document>.ts` as its SDK module. */\nasync function loadDocument(this: Rolldown.PluginContext, id: string) {\n const file = id.slice(0, -'.ts'.length);\n if (!id.endsWith('.ts') || !isDocument(file)) return null;\n const content = await readFile(file, 'utf8');\n const document = await renderDocument(file, content);\n for (const uri of document.documents) {\n if (uri.startsWith('file:')) this.addWatchFile(fileURLToPath(uri));\n }\n const fail = (problem: DocumentDiagnostic) =>\n this.error({\n message: problem.message,\n id: file,\n loc: { file, ...position(content, problem.range.start) },\n });\n if (document.kind === 'failed') return fail(document.diagnostics[0]);\n // A document with YAML errors can still render; it does not run until it is fixed.\n const [yamlError] = document.diagnostics;\n if (yamlError) return fail(yamlError);\n // Vite's SSR runner compiles modules with `new AsyncFunction(code)`, and V8's\n // eval cache keeps each such source, so every reload would leak a module. V8\n // does not cache a source with a tagged template; a build drops this dead code.\n return `${document.text}\\nif (0) (() => {})\\`\\`;\\n`;\n}\n\n/** The line (from 1) and column (from 0) of `index` in `text`, as Rollup reports a location. */\nfunction position(text: string, index: number) {\n const before = text.slice(0, index);\n const lineStart = before.lastIndexOf('\\n') + 1;\n return { line: before.split('\\n').length, column: index - lineStart };\n}\n", "import type { Plugin } from 'vite';\n\nexport interface ProjectSdkOptions {\n /** The project config file; the CLI finds it from the Vite root without one. */\n config?: string;\n}\n\n/** Generates every client of an sdk-it project, as `sdk-it generate` does. */\nexport class ProjectSdk {\n readonly #options: ProjectSdkOptions;\n #root = process.cwd();\n\n constructor(options: ProjectSdkOptions) {\n this.#options = options;\n }\n\n toPlugin(): Plugin {\n const configure = (root: string) => {\n this.#root = root;\n };\n const generate = () => this.#generate();\n return {\n name: 'sdk-it',\n configResolved(config) {\n configure(config.root);\n },\n async configureServer() {\n await generate();\n },\n async buildStart() {\n await generate();\n },\n };\n }\n\n async #generate() {\n const { generateProject, loadProjectConfig } = await import('@sdk-it/cli');\n const config = await loadProjectConfig({\n cwd: this.#root,\n config: this.#options.config,\n });\n await generateProject(config);\n }\n}\n", "import { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { OpenAPIObject } from 'openapi3-ts/oas31';\n\nimport { loadSpec } from '@sdk-it/spec';\n\n/** A spec read for one generation, and the URI of every document it was read from. */\nexport interface LoadedSpec {\n spec: OpenAPIObject;\n documents: readonly string[];\n}\n\n/** A source bound to a Vite root, ready to load. */\nexport interface ConfiguredSpec {\n /** The local file the spec starts from, when it is one. */\n readonly watchPath: string | undefined;\n load(): Promise<LoadedSpec>;\n}\n\n/** Where the spec of a generated SDK comes from. */\nexport interface SpecSource {\n configure(root: string): Promise<ConfiguredSpec>;\n}\n\n/** A spec at a path relative to the Vite root, or at a URL. */\nexport class FileSpecSource implements SpecSource {\n readonly #location: string;\n\n constructor(location: string) {\n this.#location = location;\n }\n\n async configure(root: string): Promise<ConfiguredSpec> {\n const location = this.#location;\n if (!startsWithProtocol(location)) {\n const path = join(root, location);\n return { watchPath: path, load: () => loadSpec(path) };\n }\n return {\n watchPath: location.startsWith('file:')\n ? fileURLToPath(location)\n : undefined,\n load: () => loadSpec(location),\n };\n }\n}\n\n/** A spec the Vite config holds as an object. */\nexport class DocumentSpecSource implements SpecSource {\n readonly #document: OpenAPIObject;\n\n constructor(document: OpenAPIObject) {\n this.#document = document;\n }\n\n async configure(): Promise<ConfiguredSpec> {\n return {\n watchPath: undefined,\n load: async () => ({\n spec: structuredClone(this.#document),\n documents: [],\n }),\n };\n }\n}\n\n/** A spec a function gives once Vite resolves its config: a location or an object. */\nexport class LazySpecSource implements SpecSource {\n readonly #resolve: () =>\n string | OpenAPIObject | Promise<string | OpenAPIObject>;\n\n constructor(\n resolve: () => string | OpenAPIObject | Promise<string | OpenAPIObject>,\n ) {\n this.#resolve = resolve;\n }\n\n async configure(root: string): Promise<ConfiguredSpec> {\n const resolved = await this.#resolve();\n const source =\n typeof resolved === 'string'\n ? new FileSpecSource(resolved)\n : new DocumentSpecSource(resolved);\n return source.configure(root);\n }\n}\n\nfunction startsWithProtocol(url: string): boolean {\n return /^[a-zA-Z][a-zA-Z0-9+\\-.]*:\\/\\//.test(url);\n}\n", "import type { OpenAPIObject } from 'openapi3-ts/oas31';\nimport type { Plugin } from 'vite';\n\nimport { DiskSdk, type DiskSdkSettings } from './disk-sdk.ts';\nimport { DocumentImports } from './document-imports.ts';\nimport { ProjectSdk, type ProjectSdkOptions } from './project.ts';\nimport {\n DocumentSpecSource,\n FileSpecSource,\n LazySpecSource,\n} from './spec-source.ts';\n\nexport type { DiskSdkSettings } from './disk-sdk.ts';\nexport type { ProjectSdkOptions } from './project.ts';\n\n/** The sdk-it Vite plugins, one factory for each way an SDK comes to the app. */\nexport const sdkIt = {\n /** Generates an SDK on disk from the spec at `location`: a path relative to the Vite root, or a URL. */\n file(location: string, settings: DiskSdkSettings): Plugin {\n return new DiskSdk(new FileSpecSource(location), settings).toPlugin();\n },\n /** Generates an SDK on disk from a spec object. */\n document(document: OpenAPIObject, settings: DiskSdkSettings): Plugin {\n return new DiskSdk(new DocumentSpecSource(document), settings).toPlugin();\n },\n /** Generates an SDK on disk from the location or object `resolve` gives once Vite resolves its config. */\n lazy(\n resolve: () => string | OpenAPIObject | Promise<string | OpenAPIObject>,\n settings: DiskSdkSettings,\n ): Plugin {\n return new DiskSdk(new LazySpecSource(resolve), settings).toPlugin();\n },\n /** Generates every client of an sdk-it project config. */\n project(options: ProjectSdkOptions): Plugin {\n return new ProjectSdk(options).toPlugin();\n },\n /** Serves `import { store } from './store.openapi.yaml'` as the document's SDK, with no SDK on disk. */\n imports(): Plugin {\n return new DocumentImports().toPlugin();\n },\n};\n\nexport default sdkIt;\n"],
5
+ "mappings": ";AAAA,SAAS,cAAc;AACvB,OAAO,YAAY;AACnB,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAE1B,SAAmD,qBAAqB;AAExE,SAAS,gBAAgB;;;ACPzB,SAAS,aAAa;AACtB,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB,SAAS,MAAM,eAAe;AAQvB,IAAM,eAAN,MAAM,cAAa;AAAA,EACxB,OAAgB,SAAS,IAAI;AAAA,IAC3B,IAAI,YAAY,KAAK,OAAO,GAAG,UAAU,cAAc,GAAG;AAAA,MACxD,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA;AAAA,EAEA,OAAgB,WAAW,oBAAI,IAAoB;AAAA,EAC1C;AAAA,EAET,YAAY,QAAgB;AAC1B,SAAK,QAAQ,QAAQ,MAAM;AAAA,EAC7B;AAAA,EAEA,SAAS,MAAcA,WAA8C;AACnE,WAAO,cAAa,OAAO,QAAQ,KAAK,OAAO,YAAY;AACzD,UAAI,cAAa,SAAS,IAAI,KAAK,KAAK,MAAM,KAAM;AACpD,YAAMA,UAAS;AACf,oBAAa,SAAS,IAAI,KAAK,OAAO,IAAI;AAAA,IAC5C,CAAC;AAAA,EAC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,UAAkB,UAAmC;AACxD,WAAO,IAAI,QAAQ,IAAI,eAAe,QAAQ,GAAG,QAAQ,EAAE,SAAS;AAAA,EACtE;AAAA;AAAA,EAEA,SAAS,UAAyB,UAAmC;AACnE,WAAO,IAAI,QAAQ,IAAI,mBAAmB,QAAQ,GAAG,QAAQ,EAAE,SAAS;AAAA,EAC1E;AAAA;AAAA,EAEA,KACEC,UACA,UACQ;AACR,WAAO,IAAI,QAAQ,IAAI,eAAeA,QAAO,GAAG,QAAQ,EAAE,SAAS;AAAA,EACrE;AAAA;AAAA,EAEA,QAAQ,SAAoC;AAC1C,WAAO,IAAI,WAAW,OAAO,EAAE,SAAS;AAAA,EAC1C;AAAA;AAAA,EAEA,UAAkB;AAChB,WAAO,IAAI,gBAAgB,EAAE,SAAS;AAAA,EACxC;AACF;AAEA,IAAO,gBAAQ;",
6
6
  "names": ["generate", "generate", "fileURLToPath", "normalizePath", "generate", "join", "fileURLToPath", "resolve", "resolve"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdk-it/vite",
3
- "version": "0.48.2",
3
+ "version": "0.49.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/JanuaryLabs/sdk-it",
@@ -36,17 +36,17 @@
36
36
  "!**/*.test.*"
37
37
  ],
38
38
  "devDependencies": {
39
- "@sdk-it/core": "0.48.2",
39
+ "@sdk-it/core": "0.49.1",
40
40
  "@sdk-it/testing": "*",
41
41
  "@zukhruf/fs": "^0.8.33"
42
42
  },
43
43
  "peerDependencies": {
44
- "@sdk-it/cli": "0.48.2",
45
- "@sdk-it/content-mapper": "0.48.2",
46
- "@sdk-it/spec": "0.48.2",
47
- "@sdk-it/typescript": "0.48.2",
44
+ "@sdk-it/cli": "0.49.1",
45
+ "@sdk-it/content-mapper": "0.49.1",
46
+ "@sdk-it/spec": "0.49.1",
47
+ "@sdk-it/typescript": "0.49.1",
48
48
  "openapi3-ts": "4.6.2",
49
- "vite": "^7.0.0 || ^8.0.0"
49
+ "vite": "^8.0.0"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "@sdk-it/cli": {