@windwalker-io/core 4.1.1 → 4.1.3

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/fusionfile.mjs CHANGED
@@ -15,7 +15,7 @@ import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
15
15
  export async function debuggers() {
16
16
  return webpackVueBundle(
17
17
  'src/debugger/debugger.js',
18
- 'dist/debugger/index.js',
18
+ 'dist/debugger/debugger.js',
19
19
  (config) => {
20
20
  config.resolve.alias = {
21
21
  '@': path.resolve(path.resolve(), './src/debugger/') // Will be overwrite when compile
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.3",
4
4
  "type": "module",
5
5
  "description": "Windwalker Core JS package",
6
6
  "scripts": {
@@ -1,70 +1,8 @@
1
- /**
2
- * Part of funclass project.
3
- *
4
- * @copyright Copyright (C) 2021 LYRASOFT.
5
- * @license __LICENSE__
6
- */
7
1
 
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';
2
+ import { babel, ts } from '@windwalker-io/fusion';
13
3
  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
- }
4
+ import { loadJson } from './utils.mjs';
5
+ export * from './legacy/4.0/js-aync.mjs';
68
6
 
69
7
  export function syncModuleScripts(source = 'src/Module', dest = 'www/assets/js/view/', options = {}) {
70
8
  const jsOptions = options.js || {};
@@ -79,8 +17,8 @@ export function syncModuleScripts(source = 'src/Module', dest = 'www/assets/js/v
79
17
  export function syncModuleJS(source = 'src/Module', dest = 'www/assets/js/view/', options = {}) {
80
18
  return babel(
81
19
  [
20
+ ...findModules('**/assets/*.{js,mjs}'),
82
21
  `${source}/**/*.{js,mjs}`,
83
- ...findModules('**/assets/*.{js,mjs}')
84
22
  ],
85
23
  dest,
86
24
  {
@@ -96,14 +34,14 @@ export function syncModuleJS(source = 'src/Module', dest = 'www/assets/js/view/'
96
34
  export function syncModuleTS(source = 'src/Module', dest = 'www/assets/js/view/', options = {}) {
97
35
  return ts(
98
36
  [
99
- `${source}/**/*.ts`,
100
37
  // Todo: Research if tsconfig.json can replace this line
101
38
  'resources/assets/src/**/*.d.ts',
102
- ...findModules('**/assets/*.ts')
39
+ ...findModules('**/assets/*.ts'),
40
+ `${source}/**/*.ts`,
103
41
  ],
104
42
  dest,
105
43
  {
106
- tsconfig: path.resolve('tsconfig.js.json'),
44
+ tsconfig: path.resolve('tsconfig.json'),
107
45
  rename: (path) => {
108
46
  path.dirname = path.dirname.replace(/assets$/, '').toLowerCase();
109
47
  },
@@ -129,5 +67,5 @@ export function findModules(suffix = '') {
129
67
  })
130
68
  .flat();
131
69
 
132
- return [ ...new Set(vendors) ];
70
+ return [...new Set(vendors)];
133
71
  }
@@ -90,6 +90,7 @@ function findNpmVendors(composerJsons = []) {
90
90
  .map((composerJson) => {
91
91
  return [
92
92
  ...composerJson?.extra?.windwalker?.asset_vendors || [],
93
+ ...composerJson?.extra?.windwalker?.assets?.exposes || [],
93
94
  ...Object.keys(composerJson?.extra?.windwalker?.assets?.vendors || {})
94
95
  ]
95
96
  })
@@ -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
+ ...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
+ }