@windwalker-io/core 4.2.1 → 4.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.
Files changed (34) hide show
  1. package/LICENSE +19 -19
  2. package/dist/debugger/{Dashboard-CQHU0d2H.js → Dashboard-Bm7ihi81.js} +1 -1
  3. package/dist/debugger/{Database-VIM7Qa1v.js → Database-BGuRRq-L.js} +1 -1
  4. package/dist/debugger/{DefaultLayout-B32TQLQX.js → DefaultLayout-DviqbPNR.js} +1 -1
  5. package/dist/debugger/{Events-CUBbmkGz.js → Events-CNF6gvg0.js} +1 -1
  6. package/dist/debugger/{KeyValueTable-CQHDOoM1.js → KeyValueTable-BfTkP1Rg.js} +1 -1
  7. package/dist/debugger/{Request-aNwJ2Iha.js → Request-yQA1-Fkb.js} +1 -1
  8. package/dist/debugger/{Routing-D8BolD7h.js → Routing-C5mAPB17.js} +1 -1
  9. package/dist/debugger/{System-DGIjiMcw.js → System-JFuNpoZY.js} +1 -1
  10. package/dist/debugger/{Timeline-Bj8IvPmS.js → Timeline-Uii-K9v_.js} +1 -1
  11. package/dist/debugger/debugger.js +10 -10
  12. package/dist/next.d.ts +15 -1
  13. package/dist/next.js +50 -11
  14. package/package.json +4 -4
  15. package/src/app/app.ts +43 -0
  16. package/src/asset-bundler.mjs +114 -114
  17. package/src/debugger/types/global.d.js +2 -2
  18. package/src/index.mjs +11 -11
  19. package/src/legacy/4.0/js-sync.mjs +74 -74
  20. package/src/next/fusion/index.ts +2 -2
  21. package/src/next/fusion/plugins/assets.ts +29 -29
  22. package/src/next/fusion/plugins/index.ts +3 -3
  23. package/src/next/fusion/plugins/systemjs.ts +66 -66
  24. package/src/next/fusion/processors/cloneAssets.ts +81 -81
  25. package/src/next/fusion/processors/cssModulize.ts +127 -105
  26. package/src/next/fusion/processors/index.ts +4 -4
  27. package/src/next/fusion/processors/installVendors.ts +178 -178
  28. package/src/next/fusion/processors/jsModulize.ts +293 -296
  29. package/src/next/index.ts +2 -2
  30. package/src/next/utilities/asset-sync.ts +47 -47
  31. package/src/next/utilities/crypto.ts +11 -11
  32. package/src/next/utilities/fs.ts +61 -61
  33. package/src/next/utilities/index.ts +5 -5
  34. package/src/next/utilities/modules.ts +17 -17
package/dist/next.d.ts CHANGED
@@ -18,6 +18,13 @@ export declare function containsMiddleGlob(str: string): boolean;
18
18
 
19
19
  export declare function cssModulize(entry: string, dest: string): CssModulizeProcessor;
20
20
 
21
+ export declare function cssModulizeDeep(stage: string, entry: string, dest: string, options?: CssModulizeDeepOptions): CssModulizeProcessor;
22
+
23
+ export declare interface CssModulizeDeepOptions {
24
+ mergeCss?: boolean;
25
+ parseBlades?: boolean;
26
+ }
27
+
21
28
  declare class CssModulizeProcessor implements ProcessorInterface {
22
29
  protected processor: ReturnType<typeof css>;
23
30
  protected bladePatterns: string[];
@@ -54,7 +61,14 @@ export declare function installVendors(npmVendors?: string[], to?: string): {
54
61
 
55
62
  export declare function jsModulize(entry: string, dest: string, options?: JsModulizeOptions): JsModulizeProcessor;
56
63
 
57
- declare interface JsModulizeOptions {
64
+ export declare function jsModulizeDeep(stage: string, entry: string, dest: string, options?: JsModulizeDeepOptions): JsModulizeProcessor;
65
+
66
+ export declare interface JsModulizeDeepOptions extends JsModulizeOptions {
67
+ mergeScripts?: boolean;
68
+ parseBlades?: boolean;
69
+ }
70
+
71
+ export declare interface JsModulizeOptions {
58
72
  tmpPath?: string;
59
73
  cleanTmp?: boolean;
60
74
  }
package/dist/next.js CHANGED
@@ -55,7 +55,7 @@ function findModules(suffix = "", rootModule = "src/Module") {
55
55
  }) || [];
56
56
  }).flat();
57
57
  if (rootModule) {
58
- vendors.unshift(rootModule + "/" + suffix);
58
+ vendors.push(rootModule + "/" + suffix);
59
59
  }
60
60
  return [...new Set(vendors)];
61
61
  }
@@ -199,6 +199,19 @@ function systemCSSFix() {
199
199
  function cssModulize(entry, dest) {
200
200
  return new CssModulizeProcessor(css(entry, dest));
201
201
  }
202
+ function cssModulizeDeep(stage, entry, dest, options = {}) {
203
+ const processor = cssModulize(entry, dest);
204
+ if (options.mergeCss ?? true) {
205
+ processor.mergeCss(findModules(`${stage}/**/assets/*.scss`));
206
+ }
207
+ if (options.parseBlades ?? true) {
208
+ processor.parseBlades(
209
+ findModules(`${stage}/**/*.blade.php`),
210
+ findPackages("views/**/*.blade.php")
211
+ );
212
+ }
213
+ return processor;
214
+ }
202
215
  class CssModulizeProcessor {
203
216
  constructor(processor, bladePatterns = [], cssPatterns = []) {
204
217
  this.processor = processor;
@@ -267,6 +280,21 @@ ${imports}
267
280
  function jsModulize(entry, dest, options = {}) {
268
281
  return new JsModulizeProcessor(js(entry, dest), options);
269
282
  }
283
+ function jsModulizeDeep(stage, entry, dest, options = {}) {
284
+ const processor = jsModulize(entry, dest, options).stage(stage.toLowerCase());
285
+ if (options.mergeScripts ?? true) {
286
+ processor.mergeScripts(
287
+ findModules(`${stage}/**/assets/*.ts`)
288
+ );
289
+ }
290
+ if (options.parseBlades ?? true) {
291
+ processor.parseBlades(
292
+ findModules(`${stage}/**/*.blade.php`),
293
+ findPackages("views/**/*.blade.php")
294
+ );
295
+ }
296
+ return processor;
297
+ }
270
298
  class JsModulizeProcessor {
271
299
  constructor(processor, options = {}) {
272
300
  this.processor = processor;
@@ -293,11 +321,13 @@ class JsModulizeProcessor {
293
321
  }
294
322
  });
295
323
  const scriptFiles = findFilesFromGlobArray(this.scriptPatterns);
296
- const bladeFiles = parseScriptsFromBlades(this.bladePatterns);
324
+ const bladeFiles = findBladeFiles(this.bladePatterns);
297
325
  builder.loadCallbacks.push((src, options) => {
298
326
  const srcFile = stripUrlQuery(src);
327
+ const scripts = {};
299
328
  if (normalize(srcFile) === inputFile) {
300
- let listJS = "{\n";
329
+ const bladeScripts = parseScriptsFromBlades(bladeFiles);
330
+ fs$1.removeSync(tmpPath);
301
331
  for (const scriptFile of scriptFiles) {
302
332
  let fullpath = scriptFile.fullpath;
303
333
  if (fullpath.endsWith(".d.ts")) {
@@ -310,25 +340,30 @@ class JsModulizeProcessor {
310
340
  key = this.stagePrefix + "/" + key;
311
341
  }
312
342
  key = "view:" + crypto.createHash("md5").update(key).digest("hex");
313
- listJS += `'${key}': () => import('${fullpath}'),
314
- `;
343
+ scripts[key] = fullpath;
315
344
  }
316
345
  const listens = [];
317
346
  fs$1.ensureDirSync(tmpPath);
318
- for (const result of bladeFiles) {
347
+ for (const result of bladeScripts) {
319
348
  let key = result.as;
320
349
  const tmpFile = tmpPath + "/" + result.path.replace(/\\|\//g, "_") + "-" + shortHash(result.code) + ".ts";
321
350
  if (!fs$1.existsSync(tmpFile) || fs$1.readFileSync(tmpFile, "utf8") !== result.code) {
322
351
  fs$1.writeFileSync(tmpFile, result.code);
323
352
  }
324
- listJS += `'inline:${key}': () => import('${tmpFile}'),
325
- `;
353
+ scripts[`inline:${key}`] = tmpFile;
326
354
  const fullpath = resolve(result.file.fullpath).replace(/\\/g, "/");
327
355
  if (!listens.includes(fullpath)) {
328
356
  listens.push(fullpath);
329
357
  }
330
358
  }
331
- listJS += "}";
359
+ let listJS = `{
360
+ `;
361
+ for (const key in scripts) {
362
+ const fullpath = scripts[key];
363
+ listJS += `'${key}': () => import('${fullpath}'),
364
+ `;
365
+ }
366
+ listJS += `}`;
332
367
  builder.watches.push(...listens);
333
368
  let { code, comments } = stripComments(fs$1.readFileSync(srcFile, "utf-8"));
334
369
  code = code.replace(/defineJsModules\((.*?)\)/g, listJS);
@@ -371,8 +406,10 @@ class JsModulizeProcessor {
371
406
  return this;
372
407
  }
373
408
  }
374
- function parseScriptsFromBlades(patterns) {
375
- let files = findFilesFromGlobArray(Array.isArray(patterns) ? patterns : [patterns]);
409
+ function findBladeFiles(patterns) {
410
+ return findFilesFromGlobArray(Array.isArray(patterns) ? patterns : [patterns]);
411
+ }
412
+ function parseScriptsFromBlades(files) {
376
413
  return files.map((file) => {
377
414
  const bladeText = fs$1.readFileSync(file.fullpath, "utf8");
378
415
  const html = parse(bladeText);
@@ -520,6 +557,7 @@ export {
520
557
  cloneAssets,
521
558
  containsMiddleGlob,
522
559
  cssModulize,
560
+ cssModulizeDeep,
523
561
  ensureDirPath,
524
562
  findFilesFromGlobArray,
525
563
  findModules,
@@ -528,6 +566,7 @@ export {
528
566
  injectSystemJS,
529
567
  installVendors,
530
568
  jsModulize,
569
+ jsModulizeDeep,
531
570
  loadJson,
532
571
  removeLastGlob,
533
572
  resolveModuleRealpath,
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@windwalker-io/core",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "type": "module",
5
5
  "description": "Windwalker Core JS package",
6
6
  "scripts": {
7
7
  "build": "yarn build:next && yarn build:debugger",
8
8
  "dev": "yarn dev:debugger",
9
- "build:next": "vite build --config vite.config.next.ts",
9
+ "build:next": "vite build --config vite.next.config.ts",
10
10
  "dev:next": "yarn build:next --watch",
11
- "build:debugger": "vite build --config vite.config.debugger.ts",
12
- "dev:debugger": "vite --config vite.config.debugger.ts"
11
+ "build:debugger": "vite build --config vite.debugger.config.ts",
12
+ "dev:debugger": "vite --config vite.debugger.config.ts"
13
13
  },
14
14
  "exports": {
15
15
  ".": "./src/index.js",
package/src/app/app.ts CHANGED
@@ -1,8 +1,12 @@
1
1
  type Route = string | RouteLoader;
2
2
  type RouteLoader = () => Promise<any>;
3
3
 
4
+ let currentProps: Record<string, any> | null = null;
5
+
4
6
  export class App {
5
7
  routes: Record<string, RouteLoader> = {};
8
+ queue: (() => Promise<any>)[] = [];
9
+ queueRunning = false;
6
10
 
7
11
  constructor(routes: Record<string, Route> = {}) {
8
12
  this.registerRoutes(routes);
@@ -42,9 +46,48 @@ export class App {
42
46
  return target();
43
47
  }
44
48
 
49
+ async importSync<T = any>(route: string, props: Record<string, any> = {}): Promise<T> {
50
+ return new Promise<any>((resolve) => {
51
+ const target = this.routes[route];
52
+
53
+ if (!target) {
54
+ throw new Error(`Unable to import file: ${route}, file not found.`);
55
+ }
56
+
57
+ this.queue.push(async () => {
58
+ currentProps = props;
59
+ resolve(await target());
60
+ });
61
+
62
+ this.runQueue();
63
+ });
64
+ }
65
+
66
+ async runQueue() {
67
+ if (!this.queueRunning) {
68
+ this.queueRunning = true;
69
+ let item: () => any;
70
+
71
+ while (item = this.queue.shift()) {
72
+ await item();
73
+ }
74
+
75
+ this.queueRunning = false;
76
+ }
77
+ }
78
+
45
79
  reset() {
46
80
  this.routes = {};
47
81
 
48
82
  return this;
49
83
  }
50
84
  }
85
+
86
+ export function useMacroProps<T extends Record<string, any> = Record<string, any>>(): T {
87
+ console.log('get');
88
+ if (currentProps == null) {
89
+ throw new Error('Cannot get macro props.');
90
+ }
91
+
92
+ return { ...currentProps } as T;
93
+ }
@@ -1,114 +1,114 @@
1
- import { webpackBundle } from '@windwalker-io/fusion';
2
- import fs from 'fs';
3
- import { globSync } from 'glob';
4
- import path from 'path';
5
- import { findModules } from './asset-sync.mjs';
6
-
7
- /**
8
- *
9
- * @param {string} mainFile
10
- * @param {string|string[]} source
11
- * @param {string} dest
12
- * @param {any} options
13
- * @returns {Promise<any>}
14
- */
15
- export async function bundleJS(
16
- mainFile = `./resources/assets/src/app.ts`,
17
- source = 'src/Module/**/*.ts',
18
- dest = 'www/assets/js/app/app.js',
19
- options = {}
20
- ) {
21
- const workingDir = process.cwd();
22
-
23
- if (typeof source === 'string') {
24
- source = [source];
25
- }
26
-
27
- const files = findFilesFromGlobArray([
28
- ...findModules('**/assets/*.ts'),
29
- ...source,
30
- ]);
31
-
32
- let listJS = "{\n";
33
-
34
- for (const file of files) {
35
- if (file.fullpath.endsWith('.d.ts')) {
36
- continue;
37
- }
38
-
39
- let key = file.relativePath.replace(/assets$/, '').toLowerCase();
40
- key = key.substring(0, key.lastIndexOf('.'));
41
- listJS += `'${key}': () => import('${file.fullpath}'),\n`;
42
- }
43
-
44
- listJS += "}";
45
-
46
- let ts = `
47
- import loader from '@windwalker-io/core/src/loader/core-loader.ts';
48
-
49
- loader.register(${listJS});
50
-
51
- export default loader;
52
- `;
53
-
54
- // const base64 = Buffer.from(ts).toString('base64');
55
- // const dataUri = `data:text/javascript;base64,${base64}`;
56
- const tmpDir = workingDir + '/tmp/fusion';
57
- fs.mkdirSync(tmpDir, { recursive: true });
58
-
59
- const tmpFile = tmpDir + '/app.js';
60
- fs.writeFileSync(tmpFile, ts);
61
-
62
- const r = await webpackBundle(
63
- tmpFile,
64
- dest,
65
- (config) => {
66
- config.devtool = false;
67
- // config.entry = dataUri;
68
- // config.output.uniqueName = 'app';
69
- config.output.libraryTarget = 'module';
70
- config.experiments.outputModule = true;
71
- config.resolve.modules.push(path.resolve('./'));
72
- config.context = path.resolve('./');
73
- config.resolve.alias = {
74
- '@main': path.resolve(mainFile),
75
- '@app': path.resolve(mainFile),
76
- };
77
- }
78
- );
79
-
80
- // fs.unlinkSync(tmpFile);
81
-
82
- return r;
83
- }
84
-
85
- function findFilesFromGlobArray(sources) {
86
- let files = [];
87
-
88
- for (const source of sources) {
89
- files = [
90
- ...files,
91
- ...findFiles(source)
92
- ];
93
- }
94
-
95
- return files;
96
- }
97
-
98
- /**
99
- * @param {string} src
100
- */
101
- function findFiles(src) {
102
- const i = src.lastIndexOf('**');
103
-
104
- const path = src.substring(0, i);
105
-
106
- return globSync(src).map((file) => {
107
- file = file.replace(/\\/g, '/');
108
-
109
- return {
110
- fullpath: file,
111
- relativePath: file.substring(path.length)
112
- };
113
- });
114
- }
1
+ import { webpackBundle } from '@windwalker-io/fusion';
2
+ import fs from 'fs';
3
+ import { globSync } from 'glob';
4
+ import path from 'path';
5
+ import { findModules } from './asset-sync.mjs';
6
+
7
+ /**
8
+ *
9
+ * @param {string} mainFile
10
+ * @param {string|string[]} source
11
+ * @param {string} dest
12
+ * @param {any} options
13
+ * @returns {Promise<any>}
14
+ */
15
+ export async function bundleJS(
16
+ mainFile = `./resources/assets/src/app.ts`,
17
+ source = 'src/Module/**/*.ts',
18
+ dest = 'www/assets/js/app/app.js',
19
+ options = {}
20
+ ) {
21
+ const workingDir = process.cwd();
22
+
23
+ if (typeof source === 'string') {
24
+ source = [source];
25
+ }
26
+
27
+ const files = findFilesFromGlobArray([
28
+ ...findModules('**/assets/*.ts'),
29
+ ...source,
30
+ ]);
31
+
32
+ let listJS = "{\n";
33
+
34
+ for (const file of files) {
35
+ if (file.fullpath.endsWith('.d.ts')) {
36
+ continue;
37
+ }
38
+
39
+ let key = file.relativePath.replace(/assets$/, '').toLowerCase();
40
+ key = key.substring(0, key.lastIndexOf('.'));
41
+ listJS += `'${key}': () => import('${file.fullpath}'),\n`;
42
+ }
43
+
44
+ listJS += "}";
45
+
46
+ let ts = `
47
+ import loader from '@windwalker-io/core/src/loader/core-loader.ts';
48
+
49
+ loader.register(${listJS});
50
+
51
+ export default loader;
52
+ `;
53
+
54
+ // const base64 = Buffer.from(ts).toString('base64');
55
+ // const dataUri = `data:text/javascript;base64,${base64}`;
56
+ const tmpDir = workingDir + '/tmp/fusion';
57
+ fs.mkdirSync(tmpDir, { recursive: true });
58
+
59
+ const tmpFile = tmpDir + '/app.js';
60
+ fs.writeFileSync(tmpFile, ts);
61
+
62
+ const r = await webpackBundle(
63
+ tmpFile,
64
+ dest,
65
+ (config) => {
66
+ config.devtool = false;
67
+ // config.entry = dataUri;
68
+ // config.output.uniqueName = 'app';
69
+ config.output.libraryTarget = 'module';
70
+ config.experiments.outputModule = true;
71
+ config.resolve.modules.push(path.resolve('./'));
72
+ config.context = path.resolve('./');
73
+ config.resolve.alias = {
74
+ '@main': path.resolve(mainFile),
75
+ '@app': path.resolve(mainFile),
76
+ };
77
+ }
78
+ );
79
+
80
+ // fs.unlinkSync(tmpFile);
81
+
82
+ return r;
83
+ }
84
+
85
+ function findFilesFromGlobArray(sources) {
86
+ let files = [];
87
+
88
+ for (const source of sources) {
89
+ files = [
90
+ ...files,
91
+ ...findFiles(source)
92
+ ];
93
+ }
94
+
95
+ return files;
96
+ }
97
+
98
+ /**
99
+ * @param {string} src
100
+ */
101
+ function findFiles(src) {
102
+ const i = src.lastIndexOf('**');
103
+
104
+ const path = src.substring(0, i);
105
+
106
+ return globSync(src).map((file) => {
107
+ file = file.replace(/\\/g, '/');
108
+
109
+ return {
110
+ fullpath: file,
111
+ relativePath: file.substring(path.length)
112
+ };
113
+ });
114
+ }
@@ -1,2 +1,2 @@
1
- declare module '*.jpg';
2
- declare module '*.svg';
1
+ declare module '*.jpg';
2
+ declare module '*.svg';
package/src/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
- /**
2
- * Part of funclass project.
3
- *
4
- * @copyright Copyright (C) 2021 LYRASOFT.
5
- * @license __LICENSE__
6
- */
7
-
8
- export * from './asset-sync.mjs';
9
- export * from './asset-bundler.mjs';
10
- export * from './install-vendors.mjs';
11
- export * from './app.ts';
1
+ /**
2
+ * Part of funclass project.
3
+ *
4
+ * @copyright Copyright (C) 2021 LYRASOFT.
5
+ * @license __LICENSE__
6
+ */
7
+
8
+ export * from './asset-sync.mjs';
9
+ export * from './asset-bundler.mjs';
10
+ export * from './install-vendors.mjs';
11
+ export * from './app.ts';
@@ -1,74 +1,74 @@
1
- import { findModules } from '@windwalker-io/core/src/index.mjs';
2
- import { dest as toDest, src, ts } from '@windwalker-io/fusion';
3
- import { postStream, prepareStream } from '@windwalker-io/fusion/src/lifecycles.js';
4
- import { extractDest } from '@windwalker-io/fusion/src/utilities/utilities.js';
5
- import { existsSync } from 'fs';
6
- import rename from 'gulp-rename';
7
- import path from 'path';
8
-
9
- /**
10
- * @deprecated
11
- */
12
- export function jsSync(source = 'src/Module', dest, options = {}) {
13
- const tsOptions = options.ts || {};
14
-
15
- if (!tsOptions.tsconfig) {
16
- tsOptions.tsconfig = path.resolve('tsconfig.json');
17
-
18
- if (!existsSync(tsOptions.tsconfig)) {
19
- tsOptions.tsconfig = path.resolve('node_modules/@windwalker-io/unicorn/tsconfig.js.json');
20
- }
21
- }
22
-
23
- const sourceList = [];
24
-
25
- sourceList.push(...findModules('**/assets/*.{js,mjs}'));
26
- sourceList.push(source + '**/assets/*.{js,mjs}');
27
-
28
- let stream = prepareStream(src(sourceList));
29
-
30
- stream = stream.pipe(rename((path) => {
31
- path.dirname = path.dirname.replace(/assets$/, '').toLowerCase();
32
- }));
33
-
34
- const jsDest = extractDest(dest);
35
-
36
- //
37
- // // if (dest.merge) {
38
- // // stream = stream.pipe(rename(path.basename(dest.file)));
39
- // // }
40
- //
41
- stream = stream.pipe(toDest(jsDest.path).on('error', e => console.error(e)));
42
-
43
- return Promise.all([
44
- new Promise((resolve) => {
45
- postStream(stream).on('end', (event) => {
46
- const data = {
47
- event,
48
- src,
49
- dest: jsDest,
50
- stream
51
- };
52
-
53
- resolve(data);
54
- });
55
- }),
56
- // Legacy mode
57
- ts(
58
- [
59
- ...findModules('**/assets/*.ts'),
60
- 'node_modules/@windwalker-io/unicorn/src/types/*.d.ts',
61
- `${source}/**/*.ts`,
62
- ],
63
- dest,
64
- {
65
- rename: (path) => {
66
- path.dirname = path.dirname.replace(/assets$/, '').toLowerCase();
67
- },
68
- ...tsOptions
69
- }
70
- )
71
- ]).then((v) => {
72
- return v[0];
73
- });
74
- }
1
+ import { findModules } from '@windwalker-io/core/src/index.mjs';
2
+ import { dest as toDest, src, ts } from '@windwalker-io/fusion';
3
+ import { postStream, prepareStream } from '@windwalker-io/fusion/src/lifecycles.js';
4
+ import { extractDest } from '@windwalker-io/fusion/src/utilities/utilities.js';
5
+ import { existsSync } from 'fs';
6
+ import rename from 'gulp-rename';
7
+ import path from 'path';
8
+
9
+ /**
10
+ * @deprecated
11
+ */
12
+ export function jsSync(source = 'src/Module', dest, options = {}) {
13
+ const tsOptions = options.ts || {};
14
+
15
+ if (!tsOptions.tsconfig) {
16
+ tsOptions.tsconfig = path.resolve('tsconfig.json');
17
+
18
+ if (!existsSync(tsOptions.tsconfig)) {
19
+ tsOptions.tsconfig = path.resolve('node_modules/@windwalker-io/unicorn/tsconfig.js.json');
20
+ }
21
+ }
22
+
23
+ const sourceList = [];
24
+
25
+ sourceList.push(...findModules('**/assets/*.{js,mjs}'));
26
+ sourceList.push(source + '**/assets/*.{js,mjs}');
27
+
28
+ let stream = prepareStream(src(sourceList));
29
+
30
+ stream = stream.pipe(rename((path) => {
31
+ path.dirname = path.dirname.replace(/assets$/, '').toLowerCase();
32
+ }));
33
+
34
+ const jsDest = extractDest(dest);
35
+
36
+ //
37
+ // // if (dest.merge) {
38
+ // // stream = stream.pipe(rename(path.basename(dest.file)));
39
+ // // }
40
+ //
41
+ stream = stream.pipe(toDest(jsDest.path).on('error', e => console.error(e)));
42
+
43
+ return Promise.all([
44
+ new Promise((resolve) => {
45
+ postStream(stream).on('end', (event) => {
46
+ const data = {
47
+ event,
48
+ src,
49
+ dest: jsDest,
50
+ stream
51
+ };
52
+
53
+ resolve(data);
54
+ });
55
+ }),
56
+ // Legacy mode
57
+ ts(
58
+ [
59
+ ...findModules('**/assets/*.ts'),
60
+ 'node_modules/@windwalker-io/unicorn/src/types/*.d.ts',
61
+ `${source}/**/*.ts`,
62
+ ],
63
+ dest,
64
+ {
65
+ rename: (path) => {
66
+ path.dirname = path.dirname.replace(/assets$/, '').toLowerCase();
67
+ },
68
+ ...tsOptions
69
+ }
70
+ )
71
+ ]).then((v) => {
72
+ return v[0];
73
+ });
74
+ }
@@ -1,2 +1,2 @@
1
- export * from './plugins';
2
- export * from './processors';
1
+ export * from './plugins';
2
+ export * from './processors';