@stacksjs/iconify-generator 0.2.19 → 0.2.20
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/package.json +2 -2
- package/src/index.ts +11 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/iconify-generator",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.20",
|
|
5
5
|
"description": "Generator for Iconify icon packages",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
"dev": "bun build.ts --watch"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@stacksjs/iconify-core": "0.2.
|
|
36
|
+
"@stacksjs/iconify-core": "0.2.20"
|
|
37
37
|
}
|
|
38
38
|
}
|
package/src/index.ts
CHANGED
|
@@ -809,10 +809,19 @@ export async function generatePackage(
|
|
|
809
809
|
}
|
|
810
810
|
|
|
811
811
|
/**
|
|
812
|
-
* Convert kebab-case to camelCase
|
|
812
|
+
* Convert kebab-case to a valid JS identifier in camelCase form.
|
|
813
|
+
* Iconify allows names that start with digits (e.g. "2", "3d-move") and
|
|
814
|
+
* names containing dots/slashes — none of which are legal JS identifiers.
|
|
815
|
+
* Prefix with `_` when the first char isn't [A-Za-z_$], and replace any
|
|
816
|
+
* remaining illegal chars with `_` so downstream `export { default as X }`
|
|
817
|
+
* always parses.
|
|
813
818
|
*/
|
|
814
819
|
export function toCamelCase(str: string): string {
|
|
815
|
-
|
|
820
|
+
let camel = str.replace(/-([a-z0-9])/g, g => g[1].toUpperCase())
|
|
821
|
+
camel = camel.replace(/[^a-zA-Z0-9_$]/g, '_')
|
|
822
|
+
if (/^[0-9]/.test(camel))
|
|
823
|
+
camel = `_${camel}`
|
|
824
|
+
return camel
|
|
816
825
|
}
|
|
817
826
|
|
|
818
827
|
/**
|