@jayfong/x-server 2.9.10 → 2.10.0

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.
@@ -126,6 +126,23 @@ class BuildUtil {
126
126
  loader: 'js'
127
127
  };
128
128
  });
129
+ build.onLoad({
130
+ filter: /\/vm2\/lib\/vm\.js$/
131
+ }, async args => {
132
+ let js = await _fsExtra.default.readFile(args.path, 'utf-8');
133
+
134
+ const jsDir = _nodePath.default.dirname(args.path);
135
+
136
+ const assetsDir = _nodePath.default.join(distDir, 'assets/vm2');
137
+
138
+ await _fsExtra.default.ensureDir(assetsDir);
139
+ js = js.replace(/__dirname/g, '"./assets/vm2"');
140
+ await Promise.all([_fsExtra.default.copyFile(_nodePath.default.join(jsDir, 'bridge.js'), _nodePath.default.join(assetsDir, 'bridge.js')), _fsExtra.default.copyFile(_nodePath.default.join(jsDir, 'setup-sandbox.js'), _nodePath.default.join(assetsDir, 'setup-sandbox.js'))]);
141
+ return {
142
+ contents: js,
143
+ loader: 'js'
144
+ };
145
+ });
129
146
  }
130
147
 
131
148
  }]
@@ -183,6 +200,7 @@ class BuildUtil {
183
200
  await (0, _execa.default)('tyn', {
184
201
  cwd: distDir,
185
202
  stdio: 'inherit',
203
+ // @ts-ignore
186
204
  env: {
187
205
  // 禁止 yarn 更新检测,因网络原因容易超时长时间卡住
188
206
  // https://classic.yarnpkg.com/lang/en/docs/yarnrc/#toc-disable-self-update-check
@@ -99,6 +99,20 @@ export class BuildUtil {
99
99
  loader: 'js'
100
100
  };
101
101
  });
102
+ build.onLoad({
103
+ filter: /\/vm2\/lib\/vm\.js$/
104
+ }, async args => {
105
+ let js = await fs.readFile(args.path, 'utf-8');
106
+ const jsDir = path.dirname(args.path);
107
+ const assetsDir = path.join(distDir, 'assets/vm2');
108
+ await fs.ensureDir(assetsDir);
109
+ js = js.replace(/__dirname/g, '"./assets/vm2"');
110
+ await Promise.all([fs.copyFile(path.join(jsDir, 'bridge.js'), path.join(assetsDir, 'bridge.js')), fs.copyFile(path.join(jsDir, 'setup-sandbox.js'), path.join(assetsDir, 'setup-sandbox.js'))]);
111
+ return {
112
+ contents: js,
113
+ loader: 'js'
114
+ };
115
+ });
102
116
  }
103
117
 
104
118
  }]
@@ -155,6 +169,7 @@ export class BuildUtil {
155
169
  await exec('tyn', {
156
170
  cwd: distDir,
157
171
  stdio: 'inherit',
172
+ // @ts-ignore
158
173
  env: {
159
174
  // 禁止 yarn 更新检测,因网络原因容易超时长时间卡住
160
175
  // https://classic.yarnpkg.com/lang/en/docs/yarnrc/#toc-disable-self-update-check
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "2.9.10",
3
+ "version": "2.10.0",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",