@windwalker-io/core 4.1.1 → 4.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windwalker-io/core",
3
- "version": "4.1.1",
3
+ "version": "4.1.2",
4
4
  "type": "module",
5
5
  "description": "Windwalker Core JS package",
6
6
  "scripts": {
@@ -5,66 +5,10 @@
5
5
  * @license __LICENSE__
6
6
  */
7
7
 
8
- import { babel, dest as toDest, src, ts, wait } from '@windwalker-io/fusion';
9
- import { postStream, prepareStream } from '@windwalker-io/fusion/src/lifecycles.js';
10
- import { extractDest } from '@windwalker-io/fusion/src/utilities/utilities.js';
11
- import { loadJson } from './utils.mjs';
12
- import rename from 'gulp-rename';
8
+ import { babel, ts } from '@windwalker-io/fusion';
13
9
  import path from 'path';
14
-
15
- /**
16
- * @deprecated
17
- */
18
- export function jsSync(source = 'src/Module', dest) {
19
- // const root = source + '/**/assets/';
20
-
21
- // glob(root, {}, function (err, dirs) {
22
- // for (let dir of dirs) {
23
- // glob(dir + '/**/*.{js,mjs}', { absolute: false }, (erro, files) => {
24
- // console.log(files);
25
- //
26
- // for (let file of files) {
27
- // console.log(
28
- // path.relative(dir, file)
29
- // );
30
- // }
31
- // });
32
- // }
33
- // });
34
-
35
- const sourceList = [];
36
-
37
- sourceList.push(...findModules('**/assets/*.{js,mjs,ts}'));
38
- sourceList.push(source + '**/assets/*.{js,mjs,ts}');
39
-
40
- let stream = prepareStream(src(sourceList));
41
-
42
- stream = stream.pipe(rename((path) => {
43
- path.dirname = path.dirname.replace(/assets$/, '').toLowerCase();
44
- }));
45
-
46
- const jsDest = extractDest(dest);
47
-
48
- //
49
- // // if (dest.merge) {
50
- // // stream = stream.pipe(rename(path.basename(dest.file)));
51
- // // }
52
- //
53
- stream = stream.pipe(toDest(jsDest.path).on('error', e => console.error(e)));
54
-
55
- return new Promise((resolve) => {
56
- postStream(stream).on('end', (event) => {
57
- const data = {
58
- event,
59
- src,
60
- dest: jsDest,
61
- stream
62
- };
63
-
64
- resolve(data);
65
- });
66
- });
67
- }
10
+ import { loadJson } from './utils.mjs';
11
+ export * from './legacy/4.0/js-aync.mjs';
68
12
 
69
13
  export function syncModuleScripts(source = 'src/Module', dest = 'www/assets/js/view/', options = {}) {
70
14
  const jsOptions = options.js || {};
@@ -103,7 +47,7 @@ export function syncModuleTS(source = 'src/Module', dest = 'www/assets/js/view/'
103
47
  ],
104
48
  dest,
105
49
  {
106
- tsconfig: path.resolve('tsconfig.js.json'),
50
+ tsconfig: path.resolve('tsconfig.json'),
107
51
  rename: (path) => {
108
52
  path.dirname = path.dirname.replace(/assets$/, '').toLowerCase();
109
53
  },
@@ -129,5 +73,5 @@ export function findModules(suffix = '') {
129
73
  })
130
74
  .flat();
131
75
 
132
- return [ ...new Set(vendors) ];
76
+ return [...new Set(vendors)];
133
77
  }
@@ -0,0 +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
+ `${source}/**/*.ts`,
60
+ 'node_modules/@windwalker-io/unicorn/src/types/*.d.ts',
61
+ ...findModules('**/assets/*.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
+ }