config2ts 2.5.0 → 2.5.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 +3 -3
- package/lib/config2ts.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ export type Mp3Asset = { path: string; type: 'mp3' };
|
|
|
56
56
|
export type PngAsset = { path: string; type: 'png' };
|
|
57
57
|
export type SvgAsset = { path: string; type: 'svg' };
|
|
58
58
|
|
|
59
|
-
export const
|
|
59
|
+
export const ASSETS = {
|
|
60
60
|
public: {
|
|
61
61
|
image: {
|
|
62
62
|
adjustHorizontal: {path:'public/image/adjust-horizontal.png',type:'png'},
|
|
@@ -76,9 +76,9 @@ export const RES = {
|
|
|
76
76
|
### usage
|
|
77
77
|
|
|
78
78
|
```typescript
|
|
79
|
-
import {
|
|
79
|
+
import { ASSETS } from "./assets";
|
|
80
80
|
|
|
81
|
-
const meta =
|
|
81
|
+
const meta = ASSETS.public.image.adjustHorizontal;
|
|
82
82
|
// meta.path → 'public/image/adjust-horizontal.png'
|
|
83
83
|
// meta.type → 'png'
|
|
84
84
|
```
|
package/lib/config2ts.js
CHANGED
|
@@ -443,7 +443,7 @@ function assets2ts(assetsDir) {
|
|
|
443
443
|
}
|
|
444
444
|
if (sortedExts.length > 0)
|
|
445
445
|
template += "\n";
|
|
446
|
-
template += `export const
|
|
446
|
+
template += `export const ASSETS = {\n`;
|
|
447
447
|
const rootUt = uniformDirs.get(root);
|
|
448
448
|
template += ` ${dirName}: {\n`;
|
|
449
449
|
template += serializeAssetNode(root, " ", uniformDirs, extTypeMap);
|