@pixui-dev/pxw 0.1.25 → 0.1.27

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/config/h5es.js CHANGED
@@ -8,7 +8,7 @@ module.exports.h5esVersions = [
8
8
  path: 'node_modules/@pixui-dev/pxw/lib/h5es-types/v3.5.0',
9
9
  },
10
10
  {
11
- name: 'v3.5.5',
12
- path: 'node_modules/@pixui-dev/pxw/lib/h5es-types/v3.5.5',
11
+ name: 'v3.5.6',
12
+ path: 'node_modules/@pixui-dev/pxw/lib/h5es-types/v3.5.6',
13
13
  },
14
14
  ];
package/config/pfbs.js CHANGED
@@ -151,7 +151,10 @@ module.exports.getMiddleware = () => {
151
151
  '</body>',
152
152
  `<script>
153
153
  (function() {
154
- var ws = new WebSocket('ws://' + window.location.host+ '/notify?reloadMode=RELOAD_ON_SAVE&referrer=' + encodeURIComponent(window.location.pathname))
154
+ const hostParts = window.location.host.split(':');
155
+ const hostname = hostParts[0];
156
+ const port = hostParts.length > 1 ? hostParts[1] : window.location.port;
157
+ var ws = new WebSocket('ws://' + hostname + ':'+ port + '/notify?reloadMode=RELOAD_ON_SAVE&referrer=' + encodeURIComponent(window.location.pathname))
155
158
  ws.onmessage = function (msg) {
156
159
  if (msg.data === 'reload') {
157
160
  window.location.reload();
package/config/util.js CHANGED
@@ -100,12 +100,16 @@ module.exports.getH5esType = function () {
100
100
  const tsconfigPath = path.resolve(process.cwd(), 'tsconfig.json');
101
101
  const fileContent = fs.readFileSync(tsconfigPath, 'utf8');
102
102
  const tsconfig = parse(fileContent);
103
- tsconfig.compilerOptions = tsconfig.compilerOptions || {};
104
- const existingTypeRoots = tsconfig.compilerOptions.typeRoots || [];
103
+ // tsconfig.compilerOptions = tsconfig.include || {};
104
+ const existingTypeRoots = tsconfig.include || [];
105
105
  const h5esTypeRoot = existingTypeRoots.find((root) => root.includes('h5es-types'));
106
- let slashIndex = h5esTypeRoot.lastIndexOf('/');
107
- if (slashIndex !== -1) {
108
- h5esType = h5esTypeRoot.substring(slashIndex + 1);
106
+ let h5esType = '';
107
+ if (h5esTypeRoot) {
108
+ // 使用正则表达式匹配版本号部分
109
+ const versionMatch = h5esTypeRoot.match(/h5es-types\/(v\d+\.\d+\.\d+)/);
110
+ if (versionMatch && versionMatch[1]) {
111
+ h5esType = versionMatch[1];
112
+ }
109
113
  }
110
114
  return h5esType;
111
115
  };
@@ -115,15 +119,14 @@ module.exports.setH5esType = function (newType) {
115
119
  const tsconfigPath = path.resolve(process.cwd(), 'tsconfig.json');
116
120
  const fileContent = fs.readFileSync(tsconfigPath, 'utf8');
117
121
  const tsconfig = parse(fileContent);
118
- tsconfig.compilerOptions = tsconfig.compilerOptions || {};
119
- const existingTypeRoots = tsconfig.compilerOptions.typeRoots || [];
122
+ const existingTypeRoots = tsconfig.include || [];
120
123
  let h5esTypeRoot = existingTypeRoots.find((root) => root.includes('h5es-types'));
121
124
  const updateTypeRoots = existingTypeRoots.filter((root) => !root.includes('h5es-types'));
122
125
  if (h5esTypeRoot === undefined || h5esTypeRoot != newType) {
123
- updateTypeRoots.push(newType);
126
+ updateTypeRoots.push(newType + '/h5es.d.ts');
124
127
  console.log('newType ', newType);
125
128
  h5esTypeRoot = newType;
126
- tsconfig.compilerOptions.typeRoots = updateTypeRoots;
129
+ tsconfig.include = updateTypeRoots;
127
130
  fs.writeFileSync(tsconfigPath, stringify(tsconfig, null, 2));
128
131
  try {
129
132
  cp.execSync('npx prettier-eslint --write tsconfig.json', {});
package/config/webpack.js CHANGED
@@ -71,7 +71,7 @@ if (!projectConfig.noSelfCheck && (!isShipping || process.env.withSelfcheck ===
71
71
 
72
72
  let plugins = [
73
73
  new CleanWebpackPlugin({
74
- cleanOnceBeforeBuildPatterns: ['**/*', path.join(cwd, '.build')],
74
+ cleanOnceBeforeBuildPatterns: ['**/*', path.join(cwd, 'dist/.build')],
75
75
  }),
76
76
  new ForkTsCheckerWebpackPlugin({ async: !isShipping }), //开发时异步检查,打包时同步检查以阻止错误代码
77
77
  new MiniCssExtractPlugin({