@octanejs/codemod 0.2.1 → 0.2.2
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 +97 -8
- package/dist/bin.js +2 -2
- package/dist/effect-receivers.d.ts +2 -0
- package/dist/effect-receivers.js +10 -0
- package/dist/expression-wrappers.d.ts +2 -0
- package/dist/expression-wrappers.js +19 -0
- package/dist/forwarded-props.d.ts +4 -1
- package/dist/forwarded-props.js +18 -3
- package/dist/local-react-hook.d.ts +7 -2
- package/dist/local-react-hook.js +99 -44
- package/dist/local-uses.d.ts +2 -0
- package/dist/local-uses.js +22 -0
- package/dist/mappings.d.ts +5 -1
- package/dist/mappings.js +16 -3
- package/dist/path-svg.d.ts +5 -0
- package/dist/path-svg.js +19 -2
- package/dist/project.js +868 -122
- package/dist/react-intl.d.ts +1 -1
- package/dist/react-intl.js +23 -3
- package/dist/react-island-sources.d.ts +26 -7
- package/dist/react-island-sources.js +614 -64
- package/dist/react-renderer.d.ts +2 -0
- package/dist/react-renderer.js +94 -0
- package/dist/scoped-store-contract.d.ts +6 -1
- package/dist/scoped-store-contract.js +199 -31
- package/dist/store-hook-uses.js +1 -20
- package/dist/store-inputs.js +3 -1
- package/dist/transform.d.ts +6 -0
- package/dist/transform.js +1922 -251
- package/dist/types.d.ts +24 -8
- package/package.json +4 -3
- package/src/path-svg.ts +20 -2
- package/templates/octane-path-svg.ts +4 -0
- package/templates/react-intl.tsrx +64 -11
package/dist/path-svg.d.ts
CHANGED
|
@@ -111,6 +111,11 @@ type StaticSvgNode = {
|
|
|
111
111
|
export declare function parseStaticSvg(source: string): {
|
|
112
112
|
root: Record<string, string>;
|
|
113
113
|
children: StaticSvgNode[];
|
|
114
|
+
title?: undefined;
|
|
115
|
+
} | {
|
|
116
|
+
root: Record<string, string>;
|
|
117
|
+
children: StaticSvgNode[];
|
|
118
|
+
title: string;
|
|
114
119
|
} | null;
|
|
115
120
|
export declare function parsePathSvg(source: string): {
|
|
116
121
|
root: Record<string, string>;
|
package/dist/path-svg.js
CHANGED
|
@@ -191,6 +191,7 @@ export function parseStaticSvg(source) {
|
|
|
191
191
|
if (typeof source !== 'string')
|
|
192
192
|
return null;
|
|
193
193
|
let root = null;
|
|
194
|
+
let title;
|
|
194
195
|
const children = [];
|
|
195
196
|
const open = [];
|
|
196
197
|
const definitions = new Map();
|
|
@@ -219,6 +220,20 @@ export function parseStaticSvg(source) {
|
|
|
219
220
|
return null;
|
|
220
221
|
open.push({ tag, children });
|
|
221
222
|
}
|
|
223
|
+
else if (tag === 'title') {
|
|
224
|
+
if (parent?.tag !== 'svg' || children.length || title !== undefined || fields || selfClosing)
|
|
225
|
+
return null;
|
|
226
|
+
// Keep one literal text child. XML entities, markup, and line endings require loader rules.
|
|
227
|
+
const titleToken = /([^<&]+)<\/title>/uy;
|
|
228
|
+
titleToken.lastIndex = token.lastIndex;
|
|
229
|
+
const text = titleToken.exec(source);
|
|
230
|
+
if (!text ||
|
|
231
|
+
/\]\]>|[^\u0020-\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}]/u.test(text[1]) ||
|
|
232
|
+
!text[1].trim())
|
|
233
|
+
return null;
|
|
234
|
+
title = text[1];
|
|
235
|
+
token.lastIndex = titleToken.lastIndex;
|
|
236
|
+
}
|
|
222
237
|
else {
|
|
223
238
|
if (!parent || !tag || !Object.prototype.hasOwnProperty.call(shapeAttributes, tag))
|
|
224
239
|
return null;
|
|
@@ -284,13 +299,15 @@ export function parseStaticSvg(source) {
|
|
|
284
299
|
new Set(references.map(({ id }) => id)).size === definitions.size &&
|
|
285
300
|
references.every(({ id, target, rootRect }) => definitions.get(id) === target || (rootRect && definitions.get(id) === 'pattern')) &&
|
|
286
301
|
space.test(source.slice(end))
|
|
287
|
-
?
|
|
302
|
+
? title === undefined
|
|
303
|
+
? { root, children }
|
|
304
|
+
: { root, children, title }
|
|
288
305
|
: null;
|
|
289
306
|
}
|
|
290
307
|
// Existing generated helpers expose this path-only result to their importers.
|
|
291
308
|
export function parsePathSvg(source) {
|
|
292
309
|
const svg = parseStaticSvg(source);
|
|
293
|
-
return svg && svg.children.every((node) => node.tag === 'path')
|
|
310
|
+
return svg && svg.title === undefined && svg.children.every((node) => node.tag === 'path')
|
|
294
311
|
? { root: svg.root, paths: svg.children.map((node) => node.attributes) }
|
|
295
312
|
: null;
|
|
296
313
|
}
|