@htmlplus/element 3.0.1 → 3.1.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/dist/bundlers.js +1 -1
- package/dist/transformer.d.ts +1 -0
- package/dist/transformer.js +9 -0
- package/package.json +2 -2
package/dist/bundlers.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { KEY } from './constants.js';
|
|
2
2
|
import { transformer } from './transformer.js';
|
|
3
3
|
import 'fs-extra';
|
|
4
|
+
import 'glob';
|
|
4
5
|
import '@babel/template';
|
|
5
6
|
import '@babel/types';
|
|
6
7
|
import 'change-case';
|
|
7
8
|
import '@babel/traverse';
|
|
8
9
|
import '@babel/parser';
|
|
9
|
-
import 'glob';
|
|
10
10
|
import '@babel/generator';
|
|
11
11
|
import path from 'node:path';
|
|
12
12
|
import 'ora';
|
package/dist/transformer.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ declare const ASSETS_OPTIONS: Partial<AssetsOptions>;
|
|
|
62
62
|
interface AssetsOptions {
|
|
63
63
|
destination?: (context: TransformerPluginContext) => string;
|
|
64
64
|
source?: (context: TransformerPluginContext) => string;
|
|
65
|
+
json?: (context: TransformerPluginContext) => string;
|
|
65
66
|
}
|
|
66
67
|
declare const assets: (options?: AssetsOptions) => TransformerPlugin;
|
|
67
68
|
|
package/dist/transformer.js
CHANGED
|
@@ -86,6 +86,9 @@ const ASSETS_OPTIONS = {
|
|
|
86
86
|
},
|
|
87
87
|
source(context) {
|
|
88
88
|
return path.join(context.directoryPath, 'assets');
|
|
89
|
+
},
|
|
90
|
+
json(context) {
|
|
91
|
+
return path.join('dist', 'assets', context.fileName + '.json');
|
|
89
92
|
}
|
|
90
93
|
};
|
|
91
94
|
const assets = (options) => {
|
|
@@ -100,6 +103,12 @@ const assets = (options) => {
|
|
|
100
103
|
if (!fs.existsSync(context.assetsSource))
|
|
101
104
|
continue;
|
|
102
105
|
fs.copySync(context.assetsSource, context.assetsDestination);
|
|
106
|
+
const json = options.json?.(context);
|
|
107
|
+
if (!json)
|
|
108
|
+
continue;
|
|
109
|
+
fs.ensureDirSync(path.dirname(json));
|
|
110
|
+
const files = glob.sync('**/*.*', { cwd: context.assetsDestination });
|
|
111
|
+
fs.writeJSONSync(json, files, { encoding: 'utf8', spaces: 2 });
|
|
103
112
|
}
|
|
104
113
|
};
|
|
105
114
|
return { name, finish };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@htmlplus/element",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"author": "Masood Abdolian <m.abdolian@gmail.com>",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"funding": [],
|
|
42
42
|
"engines": {
|
|
43
|
-
"node": ">=
|
|
43
|
+
"node": ">= 20.10.0"
|
|
44
44
|
},
|
|
45
45
|
"keywords": [
|
|
46
46
|
"components",
|