lvyjs 0.2.10 → 0.2.12

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/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/lib/postcss.js CHANGED
@@ -2,7 +2,7 @@ import fs from 'fs';
2
2
  import postcss from 'postcss';
3
3
  import { createRequire } from 'module';
4
4
  import { join, resolve, dirname, isAbsolute } from 'path';
5
- import { createAlias } from './config.js';
5
+ import { convertPath, createAlias } from './config.js';
6
6
 
7
7
  const require = createRequire(import.meta.url);
8
8
  const config = {
@@ -60,7 +60,7 @@ const loadPostcssConfig = (configPath, typing) => {
60
60
  for (const entry of aliasEntries) {
61
61
  if (id.startsWith(entry.find)) {
62
62
  const aliasedPath = id.replace(entry.find, entry.replacement);
63
- return resolve(basedir, aliasedPath); // 返回绝对路径
63
+ return convertPath(resolve(basedir, aliasedPath));
64
64
  }
65
65
  }
66
66
  return id; // 默认返回原始路径
@@ -77,10 +77,10 @@ const loadPostcssConfig = (configPath, typing) => {
77
77
  for (const entry of aliasEntries) {
78
78
  if (asset.url.startsWith(entry.find)) {
79
79
  const aliasedPath = asset.url.replace(entry.find, entry.replacement);
80
- return aliasedPath; // 返回解析后的 URL
80
+ return convertPath(aliasedPath);
81
81
  }
82
82
  }
83
- return asset.url; // 返回原始路径
83
+ return convertPath(asset.url);
84
84
  }
85
85
  }));
86
86
  }
package/lib/store.d.ts CHANGED
@@ -8,7 +8,7 @@ type PluginsCallBack = PluginsValue | {
8
8
  load?: PluginsValue;
9
9
  build?: PluginsValue;
10
10
  };
11
- type PluginsOptions = ((options: Options) => PluginsCallBack | void);
11
+ type PluginsOptions = (options: Options) => PluginsCallBack | void;
12
12
  type Options = {
13
13
  /**
14
14
  * 配置调整机及其回调插件
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lvyjs",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "description": "tsx compile script",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",