lvyjs 0.2.9 → 0.2.11

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/lib/index.js CHANGED
@@ -47,18 +47,13 @@ const onBuild = async () => {
47
47
  await apps.push(plugin(global.lvyConfig));
48
48
  }
49
49
  }
50
- // 执行loader
51
- await import('./main.js');
52
50
  //
53
51
  for (const app of apps) {
54
52
  if (!app) {
55
53
  continue;
56
54
  }
57
- if (typeof app == 'function') {
58
- await app(global.lvyConfig);
59
- }
60
- else if (typeof app.build == 'function') {
61
- app.build(global.lvyConfig);
55
+ if (typeof app != 'function' && typeof app.build == 'function') {
56
+ await app.build(global.lvyConfig);
62
57
  }
63
58
  }
64
59
  };
package/lib/main.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import module from 'node:module';
2
2
  import { MessageChannel } from 'node:worker_threads';
3
3
  import { postCSS } from './postcss.js';
4
+ import { assetsRegExp, stylesRegExp } from './config.js';
4
5
 
5
6
  if (!module.register) {
6
7
  throw new Error(`This version of Node.js (${process.version}) does not support module.register(). Please upgrade to Node v18.19 or v20.6 and above.`);
@@ -22,9 +23,13 @@ module.register('./loader.js', {
22
23
  data: {
23
24
  port: port2,
24
25
  lvyConfig: {
25
- alias: global.lvyConfig.alias,
26
- assets: global.lvyConfig.assets,
27
- styles: global.lvyConfig.styles
26
+ alias: global.lvyConfig?.alias,
27
+ assets: global.lvyConfig?.assets ?? {
28
+ filter: assetsRegExp
29
+ },
30
+ styles: global.lvyConfig?.styles ?? {
31
+ filter: stylesRegExp
32
+ }
28
33
  }
29
34
  },
30
35
  transferList: [port2]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lvyjs",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "tsx compile script",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",