@theia/native-webpack-plugin 1.57.1 → 1.58.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.
- package/lib/monaco-webpack-plugins.d.ts +5 -0
- package/lib/monaco-webpack-plugins.d.ts.map +1 -0
- package/lib/monaco-webpack-plugins.js +27 -0
- package/lib/monaco-webpack-plugins.js.map +1 -0
- package/lib/native-webpack-plugin.d.ts +3 -3
- package/lib/native-webpack-plugin.d.ts.map +1 -1
- package/lib/native-webpack-plugin.js +46 -29
- package/lib/native-webpack-plugin.js.map +1 -1
- package/package.json +2 -2
- package/src/monaco-webpack-plugins.ts +26 -0
- package/src/native-webpack-plugin.ts +45 -30
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monaco-webpack-plugins.d.ts","sourceRoot":"","sources":["../src/monaco-webpack-plugins.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,qBAAa,mBAAmB;IAC5B,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,GAAG,IAAI;CAM1C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2023 TypeFox and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.MonacoWebpackPlugin = void 0;
|
|
19
|
+
class MonacoWebpackPlugin {
|
|
20
|
+
apply(compiler) {
|
|
21
|
+
compiler.hooks.contextModuleFactory.tap('MonacoBuildPlugin', cmf => {
|
|
22
|
+
cmf.hooks.contextModuleFiles.tap('MonacoBuildPlugin', files => files.filter(file => !file.endsWith('.d.ts')));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.MonacoWebpackPlugin = MonacoWebpackPlugin;
|
|
27
|
+
//# sourceMappingURL=monaco-webpack-plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monaco-webpack-plugins.js","sourceRoot":"","sources":["../src/monaco-webpack-plugins.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAIhF,MAAa,mBAAmB;IAC5B,KAAK,CAAC,QAA0B;QAC5B,QAAQ,CAAC,KAAK,CAAC,oBAAoB,CAAC,GAAG,CAAC,mBAAmB,EAAE,GAAG,CAAC,EAAE;YAC/D,GAAG,CAAC,KAAK,CAAC,kBAAkB,CAAC,GAAG,CAAC,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAElH,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAPD,kDAOC"}
|
|
@@ -13,9 +13,9 @@ export declare class NativeWebpackPlugin {
|
|
|
13
13
|
constructor(options: NativeWebpackPluginOptions);
|
|
14
14
|
nativeBinding(dependency: string, nodePath: string): void;
|
|
15
15
|
apply(compiler: Compiler): void;
|
|
16
|
-
protected copyRipgrep(compiler: Compiler): Promise<void>;
|
|
17
|
-
protected copyNodePtySpawnHelper(compiler: Compiler): Promise<void>;
|
|
18
|
-
protected copyTrashHelper(compiler: Compiler): Promise<void>;
|
|
16
|
+
protected copyRipgrep(issuer: string, compiler: Compiler): Promise<void>;
|
|
17
|
+
protected copyNodePtySpawnHelper(issuer: string, compiler: Compiler): Promise<void>;
|
|
18
|
+
protected copyTrashHelper(issuer: string, compiler: Compiler): Promise<void>;
|
|
19
19
|
protected copyExecutable(source: string, target: string): Promise<void>;
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=native-webpack-plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-webpack-plugin.d.ts","sourceRoot":"","sources":["../src/native-webpack-plugin.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAQxC,MAAM,WAAW,0BAA0B;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;AAED,qBAAa,mBAAmB;IAE5B,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,OAAO,CAA6B;gBAEhC,OAAO,EAAE,0BAA0B;IAO/C,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAIzD,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"native-webpack-plugin.d.ts","sourceRoot":"","sources":["../src/native-webpack-plugin.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAQxC,MAAM,WAAW,0BAA0B;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;AAED,qBAAa,mBAAmB;IAE5B,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,OAAO,CAA6B;gBAEhC,OAAO,EAAE,0BAA0B;IAO/C,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAIzD,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;cAqEf,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;cAO9D,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;cAgBzE,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;cAelE,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMhF"}
|
|
@@ -38,6 +38,9 @@ class NativeWebpackPlugin {
|
|
|
38
38
|
}
|
|
39
39
|
apply(compiler) {
|
|
40
40
|
let replacements = {};
|
|
41
|
+
let nodePtyIssuer;
|
|
42
|
+
let trashHelperIssuer;
|
|
43
|
+
let ripgrepIssuer;
|
|
41
44
|
compiler.hooks.initialize.tap(NativeWebpackPlugin.name, async () => {
|
|
42
45
|
var _a;
|
|
43
46
|
const directory = path.resolve(compiler.outputPath, 'native-webpack-plugin');
|
|
@@ -50,79 +53,88 @@ class NativeWebpackPlugin {
|
|
|
50
53
|
await fs.promises.mkdir(directory, {
|
|
51
54
|
recursive: true
|
|
52
55
|
});
|
|
53
|
-
const bindingsFile =
|
|
54
|
-
const ripgrepFile =
|
|
55
|
-
const keymappingFile = './build/Release/keymapping.node';
|
|
56
|
-
const windowsCaCertsFile = '@vscode/windows-ca-certs/build/Release/crypt32.node';
|
|
56
|
+
const bindingsFile = (issuer) => buildFile(directory, 'bindings.js', bindingsReplacement(issuer, Array.from(this.bindings.entries())));
|
|
57
|
+
const ripgrepFile = () => buildFile(directory, 'ripgrep.js', ripgrepReplacement(this.options.out));
|
|
58
|
+
const keymappingFile = () => Promise.resolve('./build/Release/keymapping.node');
|
|
59
|
+
const windowsCaCertsFile = () => Promise.resolve('@vscode/windows-ca-certs/build/Release/crypt32.node');
|
|
57
60
|
replacements = {
|
|
58
61
|
...((_a = this.options.replacements) !== null && _a !== void 0 ? _a : {}),
|
|
59
62
|
[REQUIRE_RIPGREP]: ripgrepFile,
|
|
60
63
|
[REQUIRE_BINDINGS]: bindingsFile,
|
|
61
64
|
[REQUIRE_KEYMAPPING]: keymappingFile,
|
|
62
65
|
[REQUIRE_VSCODE_WINDOWS_CA_CERTS]: windowsCaCertsFile,
|
|
63
|
-
[REQUIRE_PARCEL_WATCHER]: findNativeWatcherFile()
|
|
66
|
+
[REQUIRE_PARCEL_WATCHER]: issuer => Promise.resolve(findNativeWatcherFile(issuer))
|
|
64
67
|
};
|
|
65
68
|
});
|
|
66
69
|
compiler.hooks.normalModuleFactory.tap(NativeWebpackPlugin.name, nmf => {
|
|
67
|
-
nmf.hooks.beforeResolve.
|
|
70
|
+
nmf.hooks.beforeResolve.tapPromise(NativeWebpackPlugin.name, async (result) => {
|
|
71
|
+
if (result.request === REQUIRE_RIPGREP) {
|
|
72
|
+
ripgrepIssuer = result.contextInfo.issuer;
|
|
73
|
+
}
|
|
74
|
+
else if (result.request === 'node-pty') {
|
|
75
|
+
nodePtyIssuer = result.contextInfo.issuer;
|
|
76
|
+
}
|
|
77
|
+
else if (result.request === 'trash') {
|
|
78
|
+
trashHelperIssuer = result.contextInfo.issuer;
|
|
79
|
+
}
|
|
68
80
|
for (const [file, replacement] of Object.entries(replacements)) {
|
|
69
81
|
if (result.request === file) {
|
|
70
|
-
result.request = replacement;
|
|
82
|
+
result.request = await replacement(result.contextInfo.issuer);
|
|
71
83
|
}
|
|
72
84
|
}
|
|
73
85
|
});
|
|
74
|
-
nmf.hooks.afterResolve.
|
|
86
|
+
nmf.hooks.afterResolve.tapPromise(NativeWebpackPlugin.name, async (result) => {
|
|
75
87
|
const createData = result.createData;
|
|
76
88
|
for (const [file, replacement] of Object.entries(replacements)) {
|
|
77
89
|
if (createData.resource === file) {
|
|
78
|
-
createData.resource = replacement;
|
|
90
|
+
createData.resource = await replacement(result.contextInfo.issuer);
|
|
79
91
|
}
|
|
80
92
|
}
|
|
81
93
|
});
|
|
82
94
|
});
|
|
83
95
|
compiler.hooks.afterEmit.tapPromise(NativeWebpackPlugin.name, async () => {
|
|
84
|
-
if (this.options.trash) {
|
|
85
|
-
await this.copyTrashHelper(compiler);
|
|
96
|
+
if (this.options.trash && trashHelperIssuer) {
|
|
97
|
+
await this.copyTrashHelper(trashHelperIssuer, compiler);
|
|
86
98
|
}
|
|
87
|
-
if (this.options.ripgrep) {
|
|
88
|
-
await this.copyRipgrep(compiler);
|
|
99
|
+
if (this.options.ripgrep && ripgrepIssuer) {
|
|
100
|
+
await this.copyRipgrep(ripgrepIssuer, compiler);
|
|
89
101
|
}
|
|
90
|
-
if (this.options.pty) {
|
|
91
|
-
await this.copyNodePtySpawnHelper(compiler);
|
|
102
|
+
if (this.options.pty && nodePtyIssuer) {
|
|
103
|
+
await this.copyNodePtySpawnHelper(nodePtyIssuer, compiler);
|
|
92
104
|
}
|
|
93
105
|
});
|
|
94
106
|
}
|
|
95
|
-
async copyRipgrep(compiler) {
|
|
107
|
+
async copyRipgrep(issuer, compiler) {
|
|
96
108
|
const suffix = process.platform === 'win32' ? '.exe' : '';
|
|
97
|
-
const sourceFile = require.resolve(`@vscode/ripgrep/bin/rg${suffix}
|
|
109
|
+
const sourceFile = require.resolve(`@vscode/ripgrep/bin/rg${suffix}`, { paths: [issuer] });
|
|
98
110
|
const targetFile = path.join(compiler.outputPath, this.options.out, `rg${suffix}`);
|
|
99
111
|
await this.copyExecutable(sourceFile, targetFile);
|
|
100
112
|
}
|
|
101
|
-
async copyNodePtySpawnHelper(compiler) {
|
|
113
|
+
async copyNodePtySpawnHelper(issuer, compiler) {
|
|
102
114
|
const targetDirectory = path.resolve(compiler.outputPath, '..', 'build', 'Release');
|
|
103
115
|
if (process.platform === 'win32') {
|
|
104
|
-
const agentFile = require.resolve('node-pty/build/Release/winpty-agent.exe');
|
|
116
|
+
const agentFile = require.resolve('node-pty/build/Release/winpty-agent.exe', { paths: [issuer] });
|
|
105
117
|
const targetAgentFile = path.join(targetDirectory, 'winpty-agent.exe');
|
|
106
118
|
await this.copyExecutable(agentFile, targetAgentFile);
|
|
107
|
-
const dllFile = require.resolve('node-pty/build/Release/winpty.dll');
|
|
119
|
+
const dllFile = require.resolve('node-pty/build/Release/winpty.dll', { paths: [issuer] });
|
|
108
120
|
const targetDllFile = path.join(targetDirectory, 'winpty.dll');
|
|
109
121
|
await this.copyExecutable(dllFile, targetDllFile);
|
|
110
122
|
}
|
|
111
|
-
else {
|
|
112
|
-
const sourceFile = require.resolve('node-pty/build/Release/spawn-helper');
|
|
123
|
+
else if (process.platform === 'darwin') {
|
|
124
|
+
const sourceFile = require.resolve('node-pty/build/Release/spawn-helper', { paths: [issuer] });
|
|
113
125
|
const targetFile = path.join(targetDirectory, 'spawn-helper');
|
|
114
126
|
await this.copyExecutable(sourceFile, targetFile);
|
|
115
127
|
}
|
|
116
128
|
}
|
|
117
|
-
async copyTrashHelper(compiler) {
|
|
129
|
+
async copyTrashHelper(issuer, compiler) {
|
|
118
130
|
let sourceFile;
|
|
119
131
|
let targetFile;
|
|
120
132
|
if (process.platform === 'win32') {
|
|
121
|
-
sourceFile = require.resolve('trash/lib/windows-trash.exe');
|
|
133
|
+
sourceFile = require.resolve('trash/lib/windows-trash.exe', { paths: [issuer] });
|
|
122
134
|
targetFile = path.join(compiler.outputPath, 'windows-trash.exe');
|
|
123
135
|
}
|
|
124
136
|
else if (process.platform === 'darwin') {
|
|
125
|
-
sourceFile = require.resolve('trash/lib/macos-trash');
|
|
137
|
+
sourceFile = require.resolve('trash/lib/macos-trash', { paths: [issuer] });
|
|
126
138
|
targetFile = path.join(compiler.outputPath, 'macos-trash');
|
|
127
139
|
}
|
|
128
140
|
if (sourceFile && targetFile) {
|
|
@@ -137,7 +149,7 @@ class NativeWebpackPlugin {
|
|
|
137
149
|
}
|
|
138
150
|
}
|
|
139
151
|
exports.NativeWebpackPlugin = NativeWebpackPlugin;
|
|
140
|
-
function findNativeWatcherFile() {
|
|
152
|
+
function findNativeWatcherFile(issuer) {
|
|
141
153
|
let name = `@parcel/watcher-${process.platform}-${process.arch}`;
|
|
142
154
|
if (process.platform === 'linux') {
|
|
143
155
|
const { MUSL, family } = require('detect-libc');
|
|
@@ -148,7 +160,9 @@ function findNativeWatcherFile() {
|
|
|
148
160
|
name += '-glibc';
|
|
149
161
|
}
|
|
150
162
|
}
|
|
151
|
-
return require.resolve(name
|
|
163
|
+
return require.resolve(name, {
|
|
164
|
+
paths: [issuer]
|
|
165
|
+
});
|
|
152
166
|
}
|
|
153
167
|
async function buildFile(root, name, content) {
|
|
154
168
|
const tmpFile = path.join(root, name);
|
|
@@ -160,10 +174,13 @@ const path = require('path');
|
|
|
160
174
|
|
|
161
175
|
exports.rgPath = path.join(__dirname, \`./${nativePath}/rg\${process.platform === 'win32' ? '.exe' : ''}\`);
|
|
162
176
|
`;
|
|
163
|
-
const bindingsReplacement = (entries) => {
|
|
177
|
+
const bindingsReplacement = (issuer, entries) => {
|
|
164
178
|
const cases = [];
|
|
165
179
|
for (const [module, node] of entries) {
|
|
166
|
-
|
|
180
|
+
const modulePath = require.resolve(node, {
|
|
181
|
+
paths: [issuer]
|
|
182
|
+
});
|
|
183
|
+
cases.push(`${' '.repeat(8)}case '${module}': return require('${modulePath.replace(/\\/g, '/')}');`);
|
|
167
184
|
}
|
|
168
185
|
return `
|
|
169
186
|
module.exports = function (jsModule) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-webpack-plugin.js","sourceRoot":"","sources":["../src/native-webpack-plugin.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,6BAA6B;AAC7B,yBAAyB;AACzB,yBAAyB;AAIzB,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAC1C,MAAM,+BAA+B,GAAG,0BAA0B,CAAC;AACnE,MAAM,gBAAgB,GAAG,UAAU,CAAC;AACpC,MAAM,kBAAkB,GAAG,4BAA4B,CAAC;AACxD,MAAM,sBAAsB,GAAG,8BAA8B,CAAC;AAW9D,MAAa,mBAAmB;IAK5B,YAAY,OAAmC;;QAHvC,aAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;QAIzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAA,OAAO,CAAC,cAAc,mCAAI,EAAE,CAAC,EAAE,CAAC;YACvE,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACpC,CAAC;IACL,CAAC;IAED,aAAa,CAAC,UAAkB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CAAC;QACH,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,MAAM,sBAAsB,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IACzG,CAAC;IAED,OAAO;;;EAGT,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC;;;EAGlB,CAAC,IAAI,EAAE,CAAC;AACV,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/native-webpack-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.58.0",
|
|
4
4
|
"description": "Webpack Plugin for native dependencies of Theia.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"tslib": "^2.6.2",
|
|
34
34
|
"webpack": "^5.76.0"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "6594f32b9727aea20d88934bf386dee06d08fa5e"
|
|
37
37
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 TypeFox and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import * as webpack from 'webpack';
|
|
18
|
+
|
|
19
|
+
export class MonacoWebpackPlugin {
|
|
20
|
+
apply(compiler: webpack.Compiler): void {
|
|
21
|
+
compiler.hooks.contextModuleFactory.tap('MonacoBuildPlugin', cmf => {
|
|
22
|
+
cmf.hooks.contextModuleFiles.tap('MonacoBuildPlugin', files => files.filter(file => !file.endsWith('.d.ts')));
|
|
23
|
+
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -52,7 +52,10 @@ export class NativeWebpackPlugin {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
apply(compiler: Compiler): void {
|
|
55
|
-
let replacements: Record<string, string
|
|
55
|
+
let replacements: Record<string, (issuer: string) => Promise<string>> = {};
|
|
56
|
+
let nodePtyIssuer: string | undefined;
|
|
57
|
+
let trashHelperIssuer: string | undefined;
|
|
58
|
+
let ripgrepIssuer: string | undefined;
|
|
56
59
|
compiler.hooks.initialize.tap(NativeWebpackPlugin.name, async () => {
|
|
57
60
|
const directory = path.resolve(compiler.outputPath, 'native-webpack-plugin');
|
|
58
61
|
if (fs.existsSync(directory)) {
|
|
@@ -64,83 +67,90 @@ export class NativeWebpackPlugin {
|
|
|
64
67
|
await fs.promises.mkdir(directory, {
|
|
65
68
|
recursive: true
|
|
66
69
|
});
|
|
67
|
-
const bindingsFile =
|
|
68
|
-
const ripgrepFile =
|
|
69
|
-
const keymappingFile = './build/Release/keymapping.node';
|
|
70
|
-
const windowsCaCertsFile = '@vscode/windows-ca-certs/build/Release/crypt32.node';
|
|
70
|
+
const bindingsFile = (issuer: string) => buildFile(directory, 'bindings.js', bindingsReplacement(issuer, Array.from(this.bindings.entries())));
|
|
71
|
+
const ripgrepFile = () => buildFile(directory, 'ripgrep.js', ripgrepReplacement(this.options.out));
|
|
72
|
+
const keymappingFile = () => Promise.resolve('./build/Release/keymapping.node');
|
|
73
|
+
const windowsCaCertsFile = () => Promise.resolve('@vscode/windows-ca-certs/build/Release/crypt32.node');
|
|
71
74
|
replacements = {
|
|
72
75
|
...(this.options.replacements ?? {}),
|
|
73
76
|
[REQUIRE_RIPGREP]: ripgrepFile,
|
|
74
77
|
[REQUIRE_BINDINGS]: bindingsFile,
|
|
75
78
|
[REQUIRE_KEYMAPPING]: keymappingFile,
|
|
76
79
|
[REQUIRE_VSCODE_WINDOWS_CA_CERTS]: windowsCaCertsFile,
|
|
77
|
-
[REQUIRE_PARCEL_WATCHER]: findNativeWatcherFile()
|
|
80
|
+
[REQUIRE_PARCEL_WATCHER]: issuer => Promise.resolve(findNativeWatcherFile(issuer))
|
|
78
81
|
};
|
|
79
82
|
});
|
|
80
83
|
compiler.hooks.normalModuleFactory.tap(
|
|
81
84
|
NativeWebpackPlugin.name,
|
|
82
85
|
nmf => {
|
|
83
|
-
nmf.hooks.beforeResolve.
|
|
86
|
+
nmf.hooks.beforeResolve.tapPromise(NativeWebpackPlugin.name, async result => {
|
|
87
|
+
if (result.request === REQUIRE_RIPGREP) {
|
|
88
|
+
ripgrepIssuer = result.contextInfo.issuer;
|
|
89
|
+
} else if (result.request === 'node-pty') {
|
|
90
|
+
nodePtyIssuer = result.contextInfo.issuer;
|
|
91
|
+
} else if (result.request === 'trash') {
|
|
92
|
+
trashHelperIssuer = result.contextInfo.issuer;
|
|
93
|
+
}
|
|
84
94
|
for (const [file, replacement] of Object.entries(replacements)) {
|
|
85
95
|
if (result.request === file) {
|
|
86
|
-
result.request = replacement;
|
|
96
|
+
result.request = await replacement(result.contextInfo.issuer);
|
|
87
97
|
}
|
|
88
98
|
}
|
|
89
99
|
});
|
|
90
|
-
nmf.hooks.afterResolve.
|
|
100
|
+
nmf.hooks.afterResolve.tapPromise(NativeWebpackPlugin.name, async result => {
|
|
91
101
|
const createData = result.createData;
|
|
92
102
|
for (const [file, replacement] of Object.entries(replacements)) {
|
|
93
103
|
if (createData.resource === file) {
|
|
94
|
-
createData.resource = replacement;
|
|
104
|
+
createData.resource = await replacement(result.contextInfo.issuer);
|
|
95
105
|
}
|
|
96
106
|
}
|
|
97
107
|
});
|
|
98
108
|
}
|
|
99
109
|
);
|
|
100
110
|
compiler.hooks.afterEmit.tapPromise(NativeWebpackPlugin.name, async () => {
|
|
101
|
-
if (this.options.trash) {
|
|
102
|
-
await this.copyTrashHelper(compiler);
|
|
111
|
+
if (this.options.trash && trashHelperIssuer) {
|
|
112
|
+
await this.copyTrashHelper(trashHelperIssuer, compiler);
|
|
103
113
|
}
|
|
104
|
-
if (this.options.ripgrep) {
|
|
105
|
-
await this.copyRipgrep(compiler);
|
|
114
|
+
if (this.options.ripgrep && ripgrepIssuer) {
|
|
115
|
+
await this.copyRipgrep(ripgrepIssuer, compiler);
|
|
106
116
|
}
|
|
107
|
-
if (this.options.pty) {
|
|
108
|
-
await this.copyNodePtySpawnHelper(compiler);
|
|
117
|
+
if (this.options.pty && nodePtyIssuer) {
|
|
118
|
+
await this.copyNodePtySpawnHelper(nodePtyIssuer, compiler);
|
|
109
119
|
}
|
|
110
120
|
});
|
|
111
121
|
}
|
|
112
122
|
|
|
113
|
-
protected async copyRipgrep(compiler: Compiler): Promise<void> {
|
|
123
|
+
protected async copyRipgrep(issuer: string, compiler: Compiler): Promise<void> {
|
|
114
124
|
const suffix = process.platform === 'win32' ? '.exe' : '';
|
|
115
|
-
const sourceFile = require.resolve(`@vscode/ripgrep/bin/rg${suffix}
|
|
125
|
+
const sourceFile = require.resolve(`@vscode/ripgrep/bin/rg${suffix}`, { paths: [issuer] });
|
|
116
126
|
const targetFile = path.join(compiler.outputPath, this.options.out, `rg${suffix}`);
|
|
117
127
|
await this.copyExecutable(sourceFile, targetFile);
|
|
118
128
|
}
|
|
119
129
|
|
|
120
|
-
protected async copyNodePtySpawnHelper(compiler: Compiler): Promise<void> {
|
|
130
|
+
protected async copyNodePtySpawnHelper(issuer: string, compiler: Compiler): Promise<void> {
|
|
121
131
|
const targetDirectory = path.resolve(compiler.outputPath, '..', 'build', 'Release');
|
|
122
132
|
if (process.platform === 'win32') {
|
|
123
|
-
const agentFile = require.resolve('node-pty/build/Release/winpty-agent.exe');
|
|
133
|
+
const agentFile = require.resolve('node-pty/build/Release/winpty-agent.exe', { paths: [issuer] });
|
|
124
134
|
const targetAgentFile = path.join(targetDirectory, 'winpty-agent.exe');
|
|
125
135
|
await this.copyExecutable(agentFile, targetAgentFile);
|
|
126
|
-
const dllFile = require.resolve('node-pty/build/Release/winpty.dll');
|
|
136
|
+
const dllFile = require.resolve('node-pty/build/Release/winpty.dll', { paths: [issuer] });
|
|
127
137
|
const targetDllFile = path.join(targetDirectory, 'winpty.dll');
|
|
128
138
|
await this.copyExecutable(dllFile, targetDllFile);
|
|
129
|
-
} else {
|
|
130
|
-
const sourceFile = require.resolve('node-pty/build/Release/spawn-helper');
|
|
139
|
+
} else if (process.platform === 'darwin') {
|
|
140
|
+
const sourceFile = require.resolve('node-pty/build/Release/spawn-helper', { paths: [issuer] });
|
|
131
141
|
const targetFile = path.join(targetDirectory, 'spawn-helper');
|
|
132
142
|
await this.copyExecutable(sourceFile, targetFile);
|
|
133
143
|
}
|
|
134
144
|
}
|
|
135
145
|
|
|
136
|
-
protected async copyTrashHelper(compiler: Compiler): Promise<void> {
|
|
146
|
+
protected async copyTrashHelper(issuer: string, compiler: Compiler): Promise<void> {
|
|
137
147
|
let sourceFile: string | undefined;
|
|
138
148
|
let targetFile: string | undefined;
|
|
139
149
|
if (process.platform === 'win32') {
|
|
140
|
-
sourceFile = require.resolve('trash/lib/windows-trash.exe');
|
|
150
|
+
sourceFile = require.resolve('trash/lib/windows-trash.exe', { paths: [issuer] });
|
|
141
151
|
targetFile = path.join(compiler.outputPath, 'windows-trash.exe');
|
|
142
152
|
} else if (process.platform === 'darwin') {
|
|
143
|
-
sourceFile = require.resolve('trash/lib/macos-trash');
|
|
153
|
+
sourceFile = require.resolve('trash/lib/macos-trash', { paths: [issuer] });
|
|
144
154
|
targetFile = path.join(compiler.outputPath, 'macos-trash');
|
|
145
155
|
}
|
|
146
156
|
if (sourceFile && targetFile) {
|
|
@@ -156,7 +166,7 @@ export class NativeWebpackPlugin {
|
|
|
156
166
|
}
|
|
157
167
|
}
|
|
158
168
|
|
|
159
|
-
function findNativeWatcherFile(): string {
|
|
169
|
+
function findNativeWatcherFile(issuer: string): string {
|
|
160
170
|
let name = `@parcel/watcher-${process.platform}-${process.arch}`;
|
|
161
171
|
if (process.platform === 'linux') {
|
|
162
172
|
const { MUSL, family } = require('detect-libc');
|
|
@@ -166,7 +176,9 @@ function findNativeWatcherFile(): string {
|
|
|
166
176
|
name += '-glibc';
|
|
167
177
|
}
|
|
168
178
|
}
|
|
169
|
-
return require.resolve(name
|
|
179
|
+
return require.resolve(name, {
|
|
180
|
+
paths: [issuer]
|
|
181
|
+
});
|
|
170
182
|
}
|
|
171
183
|
|
|
172
184
|
async function buildFile(root: string, name: string, content: string): Promise<string> {
|
|
@@ -181,11 +193,14 @@ const path = require('path');
|
|
|
181
193
|
exports.rgPath = path.join(__dirname, \`./${nativePath}/rg\${process.platform === 'win32' ? '.exe' : ''}\`);
|
|
182
194
|
`;
|
|
183
195
|
|
|
184
|
-
const bindingsReplacement = (entries: [string, string][]): string => {
|
|
196
|
+
const bindingsReplacement = (issuer: string, entries: [string, string][]): string => {
|
|
185
197
|
const cases: string[] = [];
|
|
186
198
|
|
|
187
199
|
for (const [module, node] of entries) {
|
|
188
|
-
|
|
200
|
+
const modulePath = require.resolve(node, {
|
|
201
|
+
paths: [issuer]
|
|
202
|
+
});
|
|
203
|
+
cases.push(`${' '.repeat(8)}case '${module}': return require('${modulePath.replace(/\\/g, '/')}');`);
|
|
189
204
|
}
|
|
190
205
|
|
|
191
206
|
return `
|