@hey-api/openapi-ts 0.0.0-next-20260223100743 → 0.0.0-next-20260223201612
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/dist/index.mjs +2 -2
- package/dist/{init-DotCbO2b.mjs → init-HmDMM5Zl.mjs} +17 -6
- package/dist/init-HmDMM5Zl.mjs.map +1 -0
- package/dist/internal.mjs +1 -1
- package/dist/run.mjs +3 -3
- package/dist/{src-DCAbFhpy.mjs → src-CZ5b4dpO.mjs} +3 -2
- package/dist/src-CZ5b4dpO.mjs.map +1 -0
- package/package.json +4 -4
- package/dist/init-DotCbO2b.mjs.map +0 -1
- package/dist/src-DCAbFhpy.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as clientDefaultConfig, c as TypeScriptRenderer, d as reserved, f as keywords, l as TsDslContext, m as TsDsl, n as defaultPlugins, o as clientDefaultMeta, p as regexp, r as clientPluginHandler, s as $, u as ctx } from "./init-
|
|
2
|
-
import { a as defineConfig, c as createClient, i as defaultPaginationKeywords, n as OperationPath, o as definePluginConfig, r as OperationStrategy, s as utils, t as Logger } from "./src-
|
|
1
|
+
import { a as clientDefaultConfig, c as TypeScriptRenderer, d as reserved, f as keywords, l as TsDslContext, m as TsDsl, n as defaultPlugins, o as clientDefaultMeta, p as regexp, r as clientPluginHandler, s as $, u as ctx } from "./init-HmDMM5Zl.mjs";
|
|
2
|
+
import { a as defineConfig, c as createClient, i as defaultPaginationKeywords, n as OperationPath, o as definePluginConfig, r as OperationStrategy, s as utils, t as Logger } from "./src-CZ5b4dpO.mjs";
|
|
3
3
|
|
|
4
4
|
export { $, Logger, OperationPath, OperationStrategy, TsDsl, TsDslContext, TypeScriptRenderer, clientDefaultConfig, clientDefaultMeta, clientPluginHandler, createClient, ctx, defaultPaginationKeywords, defaultPlugins, defineConfig, definePluginConfig, keywords, regexp, reserved, utils };
|
|
@@ -5337,6 +5337,16 @@ function getClientBundlePaths(pluginName) {
|
|
|
5337
5337
|
};
|
|
5338
5338
|
}
|
|
5339
5339
|
/**
|
|
5340
|
+
* Converts an {@link OutputHeader} value to a string prefix for file content.
|
|
5341
|
+
* Returns an empty string when the header is null, undefined, or a function
|
|
5342
|
+
* (functions require a render context which is not available for bundled files).
|
|
5343
|
+
*/
|
|
5344
|
+
function outputHeaderToPrefix(header) {
|
|
5345
|
+
if (header == null || typeof header === "function") return "";
|
|
5346
|
+
const content = (typeof header === "string" ? header.split(/\r?\n/) : header.flatMap((line) => line.split(/\r?\n/))).join("\n");
|
|
5347
|
+
return content ? `${content}\n\n` : "";
|
|
5348
|
+
}
|
|
5349
|
+
/**
|
|
5340
5350
|
* Returns absolute path to the client folder. This is hard-coded for now.
|
|
5341
5351
|
*/
|
|
5342
5352
|
function clientFolderAbsolutePath(config) {
|
|
@@ -5372,7 +5382,7 @@ function renameFile({ filePath, project, renamed }) {
|
|
|
5372
5382
|
renamed.set(name, renamedName);
|
|
5373
5383
|
}
|
|
5374
5384
|
}
|
|
5375
|
-
function replaceImports({ filePath, isDevMode: isDevMode$1, meta, renamed }) {
|
|
5385
|
+
function replaceImports({ filePath, header, isDevMode: isDevMode$1, meta, renamed }) {
|
|
5376
5386
|
let content = fs.readFileSync(filePath, "utf8");
|
|
5377
5387
|
if (isDevMode$1) {
|
|
5378
5388
|
content = content.replace(/from\s+['"]\.\.\/\.\.\/client-core\/bundle\//g, "from '../core/");
|
|
@@ -5386,17 +5396,16 @@ function replaceImports({ filePath, isDevMode: isDevMode$1, meta, renamed }) {
|
|
|
5386
5396
|
const replacedName = (renamed.get(fileName) ?? fileName) + (meta.importFileExtension ? meta.importFileExtension : extension);
|
|
5387
5397
|
return match.slice(0, importIndex) + [importDir, replacedName].filter(Boolean).join("/") + match.slice(importIndex + importPath.length);
|
|
5388
5398
|
});
|
|
5389
|
-
content =
|
|
5390
|
-
|
|
5391
|
-
${content}`;
|
|
5399
|
+
content = `${header ?? ""}${content}`;
|
|
5392
5400
|
fs.writeFileSync(filePath, content, "utf8");
|
|
5393
5401
|
}
|
|
5394
5402
|
/**
|
|
5395
5403
|
* Creates a `client` folder containing the same modules as the client package.
|
|
5396
5404
|
*/
|
|
5397
|
-
function generateClientBundle({ meta, outputPath, plugin, project }) {
|
|
5405
|
+
function generateClientBundle({ header, meta, outputPath, plugin, project }) {
|
|
5398
5406
|
const renamed = /* @__PURE__ */ new Map();
|
|
5399
5407
|
const devMode = isDevMode();
|
|
5408
|
+
const headerPrefix = outputHeaderToPrefix(header);
|
|
5400
5409
|
if (plugin.name.startsWith("@hey-api/client-")) {
|
|
5401
5410
|
const { clientPath, corePath } = getClientBundlePaths(plugin.name);
|
|
5402
5411
|
const coreOutputPath = path.resolve(outputPath, "core");
|
|
@@ -5422,6 +5431,7 @@ function generateClientBundle({ meta, outputPath, plugin, project }) {
|
|
|
5422
5431
|
const coreFiles = fs.readdirSync(coreOutputPath);
|
|
5423
5432
|
for (const file of coreFiles) replaceImports({
|
|
5424
5433
|
filePath: path.resolve(coreOutputPath, file),
|
|
5434
|
+
header: headerPrefix,
|
|
5425
5435
|
isDevMode: devMode,
|
|
5426
5436
|
meta,
|
|
5427
5437
|
renamed
|
|
@@ -5429,6 +5439,7 @@ function generateClientBundle({ meta, outputPath, plugin, project }) {
|
|
|
5429
5439
|
const clientFiles = fs.readdirSync(clientOutputPath);
|
|
5430
5440
|
for (const file of clientFiles) replaceImports({
|
|
5431
5441
|
filePath: path.resolve(clientOutputPath, file),
|
|
5442
|
+
header: headerPrefix,
|
|
5432
5443
|
isDevMode: devMode,
|
|
5433
5444
|
meta,
|
|
5434
5445
|
renamed
|
|
@@ -14110,4 +14121,4 @@ async function resolveJobs({ logger, userConfigs }) {
|
|
|
14110
14121
|
|
|
14111
14122
|
//#endregion
|
|
14112
14123
|
export { postProcessors as _, clientDefaultConfig as a, TypeScriptRenderer as c, reserved as d, keywords as f, getTypedConfig as g, getClientPlugin as h, generateClientBundle as i, TsDslContext as l, TsDsl as m, defaultPlugins as n, clientDefaultMeta as o, regexp as p, clientPluginHandler as r, $ as s, resolveJobs as t, ctx as u };
|
|
14113
|
-
//# sourceMappingURL=init-
|
|
14124
|
+
//# sourceMappingURL=init-HmDMM5Zl.mjs.map
|