@kubb/ast 5.0.0-alpha.49 → 5.0.0-alpha.50
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.cjs +7 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -134,10 +134,16 @@ function toCamelOrPascal(text, pascal) {
|
|
|
134
134
|
*
|
|
135
135
|
* Only splits on dots followed by a letter so that version numbers
|
|
136
136
|
* embedded in operationIds (e.g. `v2025.0`) are kept intact.
|
|
137
|
+
*
|
|
138
|
+
* Empty segments are filtered before joining. They arise when the text starts with
|
|
139
|
+
* a dot followed immediately by a letter (e.g. `..Schema` splits into `['..', 'Schema']`
|
|
140
|
+
* and `'..'` transforms to an empty string). Without this filter the join would produce
|
|
141
|
+
* a leading `/`, which `path.resolve` would interpret as an absolute path, allowing
|
|
142
|
+
* generated files to escape the configured output directory.
|
|
137
143
|
*/
|
|
138
144
|
function applyToFileParts(text, transformPart) {
|
|
139
145
|
const parts = text.split(/\.(?=[a-zA-Z])/);
|
|
140
|
-
return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join("/");
|
|
146
|
+
return parts.map((part, i) => transformPart(part, i === parts.length - 1)).filter(Boolean).join("/");
|
|
141
147
|
}
|
|
142
148
|
/**
|
|
143
149
|
* Converts `text` to camelCase.
|