@unpackjs/core 3.2.4 → 3.2.6
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/compiled/css-loader/index.js +20 -20
- package/compiled/less-loader/index.js +8 -8
- package/compiled/postcss-loader/index.js +10 -10
- package/compiled/sass-loader/index.js +9 -9
- package/dist/index.cjs +70 -655
- package/dist/index.js +99 -682
- package/dist-types/bundler-config/index.d.ts +1 -1
- package/dist-types/bundler-config/index.d.ts.map +1 -1
- package/dist-types/createUnpack.d.ts.map +1 -1
- package/dist-types/index.d.ts +0 -1
- package/dist-types/index.d.ts.map +1 -1
- package/dist-types/prebundleDeps.d.ts.map +1 -1
- package/dist-types/run/dev.d.ts.map +1 -1
- package/dist-types/types/config.d.ts +4 -1
- package/dist-types/types/config.d.ts.map +1 -1
- package/package.json +5 -5
- package/compiled/sass-loader/sass.node.js +0 -12
- package/dist-types/launch-editor/editor-info/index.d.ts +0 -4
- package/dist-types/launch-editor/editor-info/index.d.ts.map +0 -1
- package/dist-types/launch-editor/editor-info/linux.d.ts +0 -33
- package/dist-types/launch-editor/editor-info/linux.d.ts.map +0 -1
- package/dist-types/launch-editor/editor-info/macos.d.ts +0 -35
- package/dist-types/launch-editor/editor-info/macos.d.ts.map +0 -1
- package/dist-types/launch-editor/editor-info/windows.d.ts +0 -6
- package/dist-types/launch-editor/editor-info/windows.d.ts.map +0 -1
- package/dist-types/launch-editor/get-args.d.ts +0 -12
- package/dist-types/launch-editor/get-args.d.ts.map +0 -1
- package/dist-types/launch-editor/guess.d.ts +0 -3
- package/dist-types/launch-editor/guess.d.ts.map +0 -1
- package/dist-types/launch-editor/index.d.ts +0 -7
- package/dist-types/launch-editor/index.d.ts.map +0 -1
- package/dist-types/launch-editor/types.d.ts +0 -7
- package/dist-types/launch-editor/types.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -6,9 +6,6 @@ var __webpack_modules__ = {
|
|
|
6
6
|
},
|
|
7
7
|
"compiled/webpack-merge": function(module) {
|
|
8
8
|
module.exports = require("../compiled/webpack-merge/index.js");
|
|
9
|
-
},
|
|
10
|
-
"node:url": function(module) {
|
|
11
|
-
module.exports = require("node:url");
|
|
12
9
|
}
|
|
13
10
|
}, __webpack_module_cache__ = {};
|
|
14
11
|
function __webpack_require__(moduleId) {
|
|
@@ -47,17 +44,15 @@ for(var __webpack_i__ in (()=>{
|
|
|
47
44
|
restartCleaners: ()=>restartCleaners,
|
|
48
45
|
isFileExists: ()=>isFileExists,
|
|
49
46
|
getNodeEnv: ()=>getNodeEnv,
|
|
47
|
+
isWatch: ()=>isWatch,
|
|
50
48
|
isFunction: ()=>isFunction,
|
|
51
49
|
THREAD_OPTIONS: ()=>THREAD_OPTIONS,
|
|
52
50
|
debounce: ()=>debounce,
|
|
53
51
|
isDev: ()=>isDev,
|
|
54
|
-
launchEditor: ()=>launchEditor,
|
|
55
|
-
isWatch: ()=>isWatch,
|
|
56
52
|
isNodeVersionAtLeast: ()=>isNodeVersionAtLeast,
|
|
57
53
|
setNodeEnv: ()=>setNodeEnv,
|
|
58
54
|
getCompiledPkgPath: ()=>getCompiledPkgPath,
|
|
59
55
|
LogColor: ()=>logger_LogColor,
|
|
60
|
-
isDebug: ()=>isDebug,
|
|
61
56
|
CSS_MODULES_REGEX: ()=>CSS_MODULES_REGEX,
|
|
62
57
|
loadConfig: ()=>loadConfig,
|
|
63
58
|
PROD_DEFAULT_FILENAME: ()=>PROD_DEFAULT_FILENAME,
|
|
@@ -78,7 +73,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
78
73
|
findExists: ()=>findExists,
|
|
79
74
|
getUserDepVersion: ()=>getUserDepVersion,
|
|
80
75
|
NODE_MODULES_REGEX: ()=>NODE_MODULES_REGEX,
|
|
81
|
-
|
|
76
|
+
getPort: ()=>getPort,
|
|
82
77
|
getValueByPath: ()=>getValueByPath,
|
|
83
78
|
getIpv4Interfaces: ()=>getIpv4Interfaces,
|
|
84
79
|
isCI: ()=>isCI,
|
|
@@ -99,9 +94,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
99
94
|
isObject: ()=>isObject,
|
|
100
95
|
trackPerformance: ()=>trackPerformance,
|
|
101
96
|
createUnpack: ()=>createUnpack,
|
|
102
|
-
|
|
97
|
+
getTime: ()=>getTime,
|
|
103
98
|
getUserDepPath: ()=>getUserDepPath,
|
|
104
99
|
isCSSModules: ()=>isCSSModules,
|
|
100
|
+
isDebug: ()=>isDebug,
|
|
105
101
|
rspack: ()=>core_namespaceObject.rspack
|
|
106
102
|
});
|
|
107
103
|
let core_namespaceObject = require("@rspack/core"), external_picocolors_namespaceObject = require("picocolors"), colors = {
|
|
@@ -116,8 +112,8 @@ for(var __webpack_i__ in (()=>{
|
|
|
116
112
|
}, external_node_fs_namespaceObject = require("node:fs");
|
|
117
113
|
var external_node_fs_default = __webpack_require__.n(external_node_fs_namespaceObject);
|
|
118
114
|
let external_node_path_namespaceObject = require("node:path");
|
|
119
|
-
var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject)
|
|
120
|
-
let external_jiti_namespaceObject = require("jiti"), external_node_readline_namespaceObject = require("node:readline");
|
|
115
|
+
var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject);
|
|
116
|
+
let external_node_url_namespaceObject = require("node:url"), external_jiti_namespaceObject = require("jiti"), external_node_readline_namespaceObject = require("node:readline");
|
|
121
117
|
var external_node_readline_default = __webpack_require__.n(external_node_readline_namespaceObject), logger_LogColor = function(LogColor) {
|
|
122
118
|
return LogColor.error = "red", LogColor.warn = "yellow", LogColor.info = "cyan", LogColor.ready = "green", LogColor.event = "magenta", LogColor.wait = "blue", LogColor.debug = "dim", LogColor;
|
|
123
119
|
}({});
|
|
@@ -343,10 +339,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
343
339
|
'build' === command ? setNodeEnv((null == cliOptions ? void 0 : cliOptions.watch) ? 'development' : 'production') : (setNodeEnv('development'), setDevServer(!0));
|
|
344
340
|
let root = (null == cliOptions ? void 0 : cliOptions.root) ? external_node_path_default().resolve(cliOptions.root) : process.cwd(), configFilePath = resolveConfigPath(root, null == cliOptions ? void 0 : cliOptions.config), configExport = {};
|
|
345
341
|
if (configFilePath) {
|
|
346
|
-
if (isNodeVersionAtLeast(
|
|
342
|
+
if (isNodeVersionAtLeast(22, 18) || /\.(?:js|mjs|cjs)$/.test(configFilePath)) {
|
|
347
343
|
logger_logger.debug('loading config file with native loader:', colors.dim(configFilePath));
|
|
348
344
|
try {
|
|
349
|
-
let configFileURL = (0,
|
|
345
|
+
let configFileURL = (0, external_node_url_namespaceObject.pathToFileURL)(configFilePath).href, exportModule = await import(`${configFileURL}?t=${Date.now()}`);
|
|
350
346
|
configExport = exportModule.default ? exportModule.default : exportModule;
|
|
351
347
|
} catch (err) {
|
|
352
348
|
throw logger_logger.error('failed to load config file with native loader:', colors.dim(configFilePath)), err;
|
|
@@ -412,12 +408,6 @@ for(var __webpack_i__ in (()=>{
|
|
|
412
408
|
}
|
|
413
409
|
return null;
|
|
414
410
|
}
|
|
415
|
-
function getNormalizedPluginsByHook(hook, plugins) {
|
|
416
|
-
let pluginMap = new Map();
|
|
417
|
-
return null == plugins || plugins.forEach((plugin)=>{
|
|
418
|
-
plugin[hook] && pluginMap.set(plugin.name, plugin);
|
|
419
|
-
}), Array.from(pluginMap.values());
|
|
420
|
-
}
|
|
421
411
|
let external_dotenv_expand_namespaceObject = require("dotenv-expand"), isFileSync = (filePath)=>{
|
|
422
412
|
try {
|
|
423
413
|
var _fs_statSync;
|
|
@@ -447,7 +437,14 @@ for(var __webpack_i__ in (()=>{
|
|
|
447
437
|
recursive: !0,
|
|
448
438
|
force: !0
|
|
449
439
|
});
|
|
450
|
-
}, DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm
|
|
440
|
+
}, DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
441
|
+
function getNormalizedPluginsByHook(hook, plugins) {
|
|
442
|
+
let pluginMap = new Map();
|
|
443
|
+
return null == plugins || plugins.forEach((plugin)=>{
|
|
444
|
+
plugin[hook] && pluginMap.set(plugin.name, plugin);
|
|
445
|
+
}), Array.from(pluginMap.values());
|
|
446
|
+
}
|
|
447
|
+
let external_ts_checker_rspack_plugin_namespaceObject = require("ts-checker-rspack-plugin");
|
|
451
448
|
async function getBuildDependencies(root, userBuildDependencies, envFilePaths) {
|
|
452
449
|
let rootPackageJson = external_node_path_default().join(root, 'package.json'), browserslistConfig = external_node_path_default().join(root, '.browserslistrc'), tsconfigPath = external_node_path_default().join(root, 'tsconfig.json'), buildDependencies = {};
|
|
453
450
|
await isFileExists(rootPackageJson) && (buildDependencies.packageJson = [
|
|
@@ -662,7 +659,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
662
659
|
apply(compiler) {
|
|
663
660
|
let meta = JSON.stringify({
|
|
664
661
|
name: jsMinify_PLUGIN_NAME,
|
|
665
|
-
version: "3.2.
|
|
662
|
+
version: "3.2.6",
|
|
666
663
|
options: this.minifyOptions
|
|
667
664
|
});
|
|
668
665
|
compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
|
|
@@ -698,7 +695,6 @@ for(var __webpack_i__ in (()=>{
|
|
|
698
695
|
}
|
|
699
696
|
}
|
|
700
697
|
let external_node_child_process_namespaceObject = require("node:child_process");
|
|
701
|
-
var external_node_child_process_default = __webpack_require__.n(external_node_child_process_namespaceObject);
|
|
702
698
|
function oxlint_define_property(obj, key, value) {
|
|
703
699
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
704
700
|
value: value,
|
|
@@ -996,9 +992,18 @@ for(var __webpack_i__ in (()=>{
|
|
|
996
992
|
}
|
|
997
993
|
}
|
|
998
994
|
let BundleAnalyzerPlugin = __webpack_require__("compiled/webpack-bundle-analyzer").BundleAnalyzerPlugin;
|
|
999
|
-
async function getBundlerConfig(
|
|
995
|
+
async function getBundlerConfig(originalUnpackConfig) {
|
|
1000
996
|
var _unpackConfig_build, _unpackConfig_build1, _unpackConfig_build2, _unpackConfig_build3, _unpackConfig_build4, _unpackConfig_build5, _unpackConfig_build6, _unpackConfig_html, _unpackConfig_html1, _unpackConfig_html2, _unpackConfig_html3, _unpackConfig_html4, _unpackConfig_html5, _unpackConfig_html6, _unpackConfig_html7, _unpackConfig_performance, _unpackConfig_performance1, _unpackConfig_build7, _unpackConfig_resolve, _unpackConfig_resolve1, _unpackConfig_dev, _unpackConfig_build8, _unpackConfig_experiments, _unpackConfig_build9, _unpackConfig_dev1;
|
|
1001
|
-
let circularCount,
|
|
997
|
+
let circularCount, { plugins, bundlerConfig, ...rest } = originalUnpackConfig;
|
|
998
|
+
for (let plugin of getNormalizedPluginsByHook('config', plugins))rest = await plugin.config(rest, {
|
|
999
|
+
...originalUnpackConfig._context,
|
|
1000
|
+
mergeConfig: mergeConfig
|
|
1001
|
+
});
|
|
1002
|
+
let unpackConfig = {
|
|
1003
|
+
...rest,
|
|
1004
|
+
plugins,
|
|
1005
|
+
bundlerConfig
|
|
1006
|
+
}, tsconfigPath = external_node_path_default().resolve(unpackConfig.root, 'tsconfig.json'), isTs = external_node_fs_default().existsSync(tsconfigPath), minifyOptions = isPlainObject(null == (_unpackConfig_build = unpackConfig.build) ? void 0 : _unpackConfig_build.minify) ? null == (_unpackConfig_build1 = unpackConfig.build) ? void 0 : _unpackConfig_build1.minify : {}, ProgressPlugin = (null == (_unpackConfig_build2 = unpackConfig.build) ? void 0 : _unpackConfig_build2.progressBar) ? ProgressRspackPlugin : ProgressLiteRspackPlugin, { publicVars, filePaths: envFilePaths } = function({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
|
|
1002
1007
|
'PUBLIC_'
|
|
1003
1008
|
], processEnv = process.env } = {}) {
|
|
1004
1009
|
if ('local' === mode) throw Error(`${colors.yellow('local')} cannot be used as a value for env mode, because ${colors.yellow('.env.local')} represents a temporary local file. Please use another value.`);
|
|
@@ -1225,13 +1230,16 @@ for(var __webpack_i__ in (()=>{
|
|
|
1225
1230
|
...(null == (_unpackConfig_resolve1 = unpackConfig.resolve) ? void 0 : _unpackConfig_resolve1.extensions) || []
|
|
1226
1231
|
]
|
|
1227
1232
|
},
|
|
1233
|
+
lazyCompilation: (null == (_unpackConfig_dev = unpackConfig.dev) ? void 0 : _unpackConfig_dev.lazyCompilation) && utils_isDevServer() && {
|
|
1234
|
+
imports: !0,
|
|
1235
|
+
entries: !!unpackConfig.mpa
|
|
1236
|
+
},
|
|
1228
1237
|
experiments: {
|
|
1229
|
-
lazyCompilation: (null == (_unpackConfig_dev = unpackConfig.dev) ? void 0 : _unpackConfig_dev.lazyCompilation) && utils_isDevServer() && {
|
|
1230
|
-
imports: !0,
|
|
1231
|
-
entries: !!unpackConfig.mpa
|
|
1232
|
-
},
|
|
1233
1238
|
css: !1,
|
|
1234
|
-
asyncWebAssembly: !0
|
|
1239
|
+
asyncWebAssembly: !0,
|
|
1240
|
+
lazyBarrel: !0,
|
|
1241
|
+
inlineEnum: !0,
|
|
1242
|
+
typeReexportsPresence: !0
|
|
1235
1243
|
},
|
|
1236
1244
|
optimization: {
|
|
1237
1245
|
moduleIds: isDev() ? 'named' : 'deterministic',
|
|
@@ -1840,15 +1848,20 @@ for(var __webpack_i__ in (()=>{
|
|
|
1840
1848
|
...unpackConfig.externals
|
|
1841
1849
|
}, unpackConfig.plugins.push({
|
|
1842
1850
|
name: 'unpack:prebundle',
|
|
1851
|
+
config: (config)=>{
|
|
1852
|
+
var _config_html;
|
|
1853
|
+
let originalHeadTag = (null == (_config_html = config.html) ? void 0 : _config_html.headTag) || '', sortedPreTags = preJsAssets.sort((a, b)=>a.order - b.order).map((item)=>item.path).map((item)=>`<script defer src="${item}"></script>`);
|
|
1854
|
+
return setValueByPath(config, [
|
|
1855
|
+
'html',
|
|
1856
|
+
'headTag'
|
|
1857
|
+
], `${sortedPreTags.join('')}${originalHeadTag}`), config;
|
|
1858
|
+
},
|
|
1843
1859
|
bundlerConfig: (config)=>{
|
|
1844
1860
|
let PLUGIN_NAME = 'PluginInjectAssets';
|
|
1845
1861
|
return config.plugins.push({
|
|
1846
1862
|
apply: (compiler)=>{
|
|
1847
1863
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation)=>{
|
|
1848
|
-
core_namespaceObject.rspack.HtmlRspackPlugin.getCompilationHooks(compilation).beforeAssetTagGeneration.tapPromise(PLUGIN_NAME, async (args)=>
|
|
1849
|
-
let sortedPreJsAssets = preJsAssets.sort((a, b)=>a.order - b.order).map((item)=>item.path);
|
|
1850
|
-
return args.assets.js.unshift(...sortedPreJsAssets, ...jsAssets), args.assets.css.unshift(...cssAssets), args;
|
|
1851
|
-
});
|
|
1864
|
+
core_namespaceObject.rspack.HtmlRspackPlugin.getCompilationHooks(compilation).beforeAssetTagGeneration.tapPromise(PLUGIN_NAME, async (args)=>(args.assets.js.unshift(...jsAssets), args.assets.css.unshift(...cssAssets), args));
|
|
1852
1865
|
});
|
|
1853
1866
|
}
|
|
1854
1867
|
}), config;
|
|
@@ -1863,11 +1876,19 @@ for(var __webpack_i__ in (()=>{
|
|
|
1863
1876
|
unpackConfig
|
|
1864
1877
|
}));
|
|
1865
1878
|
let config = await getBundlerConfig(unpackConfig), compiler = (0, core_namespaceObject.rspack)(config), port = await getPort(null == (_unpackConfig_server = unpackConfig.server) ? void 0 : _unpackConfig_server.port), proxyConfig = null == (_unpackConfig_server1 = unpackConfig.server) ? void 0 : _unpackConfig_server1.proxy;
|
|
1866
|
-
isPlainObject(proxyConfig) && (proxyConfig = Object.entries(proxyConfig).map(([contextStr, target])=>
|
|
1879
|
+
isPlainObject(proxyConfig) && (proxyConfig = Object.entries(proxyConfig).map(([contextStr, target])=>{
|
|
1880
|
+
let baseConfig = {
|
|
1867
1881
|
context: contextStr.split(','),
|
|
1868
|
-
target,
|
|
1869
1882
|
changeOrigin: !0
|
|
1870
|
-
}
|
|
1883
|
+
};
|
|
1884
|
+
return isPlainObject(target) ? {
|
|
1885
|
+
...baseConfig,
|
|
1886
|
+
...target
|
|
1887
|
+
} : {
|
|
1888
|
+
...baseConfig,
|
|
1889
|
+
target
|
|
1890
|
+
};
|
|
1891
|
+
}));
|
|
1871
1892
|
let devServerOptions = {
|
|
1872
1893
|
hot: !0,
|
|
1873
1894
|
port,
|
|
@@ -1885,7 +1906,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1885
1906
|
(null == (_req_headers_accept = req.headers.accept) ? void 0 : _req_headers_accept.includes('html')) && (req.url = '/index.html'), next();
|
|
1886
1907
|
}), middlewares.unshift(core_namespaceObject.experiments.lazyCompilationMiddleware(compiler)), middlewares);
|
|
1887
1908
|
let server = new (external_webpack_dev_server_default())(devServerOptions, compiler);
|
|
1888
|
-
await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.2.
|
|
1909
|
+
await server.start(), logger_logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.2.6`)} ${colors.dim(`ready in ${colors.reset(Math.ceil(performance.now() - global.__unpack_start_time))}ms`)}\n`), function(port) {
|
|
1889
1910
|
let addressUrls = getAddressUrls({
|
|
1890
1911
|
port
|
|
1891
1912
|
});
|
|
@@ -1903,7 +1924,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1903
1924
|
}
|
|
1904
1925
|
}
|
|
1905
1926
|
function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
|
|
1906
|
-
let resolveConfig =
|
|
1927
|
+
let resolveConfig = ()=>{
|
|
1907
1928
|
let defaultConfig = {
|
|
1908
1929
|
root: cwd,
|
|
1909
1930
|
build: {
|
|
@@ -1937,633 +1958,28 @@ for(var __webpack_i__ in (()=>{
|
|
|
1937
1958
|
envPrefix: [
|
|
1938
1959
|
'PUBLIC_'
|
|
1939
1960
|
]
|
|
1940
|
-
}
|
|
1941
|
-
callerName,
|
|
1942
|
-
version: "3.2.4"
|
|
1943
|
-
}, { plugins, bundlerConfig, ...rest } = mergeConfig(defaultConfig, config);
|
|
1944
|
-
for (let plugin of getNormalizedPluginsByHook('config', plugins))rest = await plugin.config(rest, {
|
|
1945
|
-
..._context,
|
|
1946
|
-
mergeConfig: mergeConfig
|
|
1947
|
-
});
|
|
1961
|
+
};
|
|
1948
1962
|
return {
|
|
1949
|
-
...
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1963
|
+
...mergeConfig(defaultConfig, config),
|
|
1964
|
+
_context: {
|
|
1965
|
+
callerName,
|
|
1966
|
+
version: "3.2.6"
|
|
1967
|
+
}
|
|
1953
1968
|
};
|
|
1954
1969
|
};
|
|
1955
1970
|
return {
|
|
1956
1971
|
build: async ({ watch } = {})=>{
|
|
1957
1972
|
setNodeEnv(watch ? 'development' : 'production');
|
|
1958
|
-
let config =
|
|
1959
|
-
console.log(colors.rainbow(`${callerName} v3.2.
|
|
1973
|
+
let config = resolveConfig();
|
|
1974
|
+
console.log(colors.rainbow(`${callerName} v3.2.6`), colors.green(`building for ${getNodeEnv()}...`)), await unpackBuild(config);
|
|
1960
1975
|
},
|
|
1961
1976
|
dev: async ()=>{
|
|
1962
|
-
global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0)
|
|
1977
|
+
global.__unpack_start_time = performance.now(), setNodeEnv('development'), setDevServer(!0);
|
|
1978
|
+
let config = resolveConfig();
|
|
1979
|
+
await unpackDev(config);
|
|
1963
1980
|
}
|
|
1964
1981
|
};
|
|
1965
1982
|
}
|
|
1966
|
-
let COMMON_EDITORS_MAP = {
|
|
1967
|
-
darwin: {
|
|
1968
|
-
'/Cursor.app/Contents/MacOS/Cursor': '/Cursor.app/Contents/MacOS/Cursor',
|
|
1969
|
-
'/Comate.app/Contents/MacOS/Electron': '/Comate.app/Contents/MacOS/Electron',
|
|
1970
|
-
'/Windsurf.app/Contents/MacOS/Electron': '/Windsurf.app/Contents/MacOS/Electron',
|
|
1971
|
-
'/Trae.app/Contents/MacOS/Electron': '/Trae.app/Contents/MacOS/Electron',
|
|
1972
|
-
'/Trae CN.app/Contents/MacOS/Electron': '/Trae CN.app/Contents/MacOS/Electron',
|
|
1973
|
-
'/Visual Studio Code.app/Contents/MacOS/Electron': '/Visual Studio Code.app/Contents/MacOS/Electron',
|
|
1974
|
-
'/Visual Studio Code - Insiders.app/Contents/MacOS/Electron': '/Visual Studio Code - Insiders.app/Contents/MacOS/Electron',
|
|
1975
|
-
'/VSCodium.app/Contents/MacOS/Electron': '/VSCodium.app/Contents/MacOS/Electron',
|
|
1976
|
-
'/WebStorm.app/Contents/MacOS/webstorm': '/WebStorm.app/Contents/MacOS/webstorm',
|
|
1977
|
-
'/HBuilderX.app/Contents/MacOS/HBuilderX': '/HBuilderX.app/Contents/MacOS/HBuilderX',
|
|
1978
|
-
'/Atom.app/Contents/MacOS/Atom': 'atom',
|
|
1979
|
-
'/Atom Beta.app/Contents/MacOS/Atom Beta': '/Atom Beta.app/Contents/MacOS/Atom Beta',
|
|
1980
|
-
'/Brackets.app/Contents/MacOS/Brackets': 'brackets',
|
|
1981
|
-
'/Sublime Text.app/Contents/MacOS/Sublime Text': '/Sublime Text.app/Contents/SharedSupport/bin/subl',
|
|
1982
|
-
'/Sublime Text.app/Contents/MacOS/sublime_text': '/Sublime Text.app/Contents/SharedSupport/bin/subl',
|
|
1983
|
-
'/Sublime Text 2.app/Contents/MacOS/Sublime Text 2': '/Sublime Text 2.app/Contents/SharedSupport/bin/subl',
|
|
1984
|
-
'/Sublime Text Dev.app/Contents/MacOS/Sublime Text': '/Sublime Text Dev.app/Contents/SharedSupport/bin/subl',
|
|
1985
|
-
'/PhpStorm.app/Contents/MacOS/phpstorm': '/PhpStorm.app/Contents/MacOS/phpstorm',
|
|
1986
|
-
'/PyCharm.app/Contents/MacOS/pycharm': '/PyCharm.app/Contents/MacOS/pycharm',
|
|
1987
|
-
'/PyCharm CE.app/Contents/MacOS/pycharm': '/PyCharm CE.app/Contents/MacOS/pycharm',
|
|
1988
|
-
'/IntelliJ IDEA.app/Contents/MacOS/idea': '/IntelliJ IDEA.app/Contents/MacOS/idea',
|
|
1989
|
-
'/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea': '/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea',
|
|
1990
|
-
'/IntelliJ IDEA Community Edition.app/Contents/MacOS/idea': '/IntelliJ IDEA Community Edition.app/Contents/MacOS/idea',
|
|
1991
|
-
'/Zed.app/Contents/MacOS/zed': 'zed',
|
|
1992
|
-
'/GoLand.app/Contents/MacOS/goland': '/GoLand.app/Contents/MacOS/goland',
|
|
1993
|
-
'/AppCode.app/Contents/MacOS/appcode': '/AppCode.app/Contents/MacOS/appcode',
|
|
1994
|
-
'/CLion.app/Contents/MacOS/clion': '/CLion.app/Contents/MacOS/clion',
|
|
1995
|
-
'/RubyMine.app/Contents/MacOS/rubymine': '/RubyMine.app/Contents/MacOS/rubymine',
|
|
1996
|
-
'/MacVim.app/Contents/MacOS/MacVim': 'mvim',
|
|
1997
|
-
'/Rider.app/Contents/MacOS/rider': '/Rider.app/Contents/MacOS/rider'
|
|
1998
|
-
},
|
|
1999
|
-
linux: {
|
|
2000
|
-
cursor: 'cursor',
|
|
2001
|
-
windsurf: 'windsurf',
|
|
2002
|
-
code: 'code',
|
|
2003
|
-
vscodium: 'vscodium',
|
|
2004
|
-
codium: 'codium',
|
|
2005
|
-
webstorm: 'webstorm',
|
|
2006
|
-
'webstorm.sh': 'webstorm',
|
|
2007
|
-
hbuilderx: 'hbuilderx',
|
|
2008
|
-
'hbuilderx.sh': 'hbuilderx',
|
|
2009
|
-
atom: 'atom',
|
|
2010
|
-
Brackets: 'brackets',
|
|
2011
|
-
'code-insiders': 'code-insiders',
|
|
2012
|
-
emacs: 'emacs',
|
|
2013
|
-
gvim: 'gvim',
|
|
2014
|
-
idea: 'idea',
|
|
2015
|
-
'idea.sh': 'idea',
|
|
2016
|
-
phpstorm: 'phpstorm',
|
|
2017
|
-
'phpstorm.sh': 'phpstorm',
|
|
2018
|
-
pycharm: 'pycharm',
|
|
2019
|
-
'pycharm.sh': 'pycharm',
|
|
2020
|
-
rubymine: 'rubymine',
|
|
2021
|
-
'rubymine.sh': 'rubymine',
|
|
2022
|
-
sublime_text: 'subl',
|
|
2023
|
-
vim: 'vim',
|
|
2024
|
-
goland: 'goland',
|
|
2025
|
-
'goland.sh': 'goland',
|
|
2026
|
-
rider: 'rider',
|
|
2027
|
-
'rider.sh': 'rider'
|
|
2028
|
-
},
|
|
2029
|
-
win32: {
|
|
2030
|
-
'Cursor.exe': '',
|
|
2031
|
-
'Windsurf.exe': '',
|
|
2032
|
-
'Trae.exe': '',
|
|
2033
|
-
'Trae CN.exe': '',
|
|
2034
|
-
'comate.exe': '',
|
|
2035
|
-
'Code.exe': '',
|
|
2036
|
-
'Code - Insiders.exe': '',
|
|
2037
|
-
'VSCodium.exe': '',
|
|
2038
|
-
'webstorm.exe': '',
|
|
2039
|
-
'webstorm64.exe': '',
|
|
2040
|
-
'HBuilderX.exe': '',
|
|
2041
|
-
'HBuilderX64.exe': '',
|
|
2042
|
-
'HBuilder.exe': '',
|
|
2043
|
-
'HBuilder64.exe': '',
|
|
2044
|
-
'Brackets.exe': '',
|
|
2045
|
-
'atom.exe': '',
|
|
2046
|
-
'sublime_text.exe': '',
|
|
2047
|
-
'notepad++.exe': '',
|
|
2048
|
-
'clion.exe': '',
|
|
2049
|
-
'clion64.exe': '',
|
|
2050
|
-
'idea.exe': '',
|
|
2051
|
-
'idea64.exe': '',
|
|
2052
|
-
'phpstorm.exe': '',
|
|
2053
|
-
'phpstorm64.exe': '',
|
|
2054
|
-
'pycharm.exe': '',
|
|
2055
|
-
'pycharm64.exe': '',
|
|
2056
|
-
'rubymine.exe': '',
|
|
2057
|
-
'rubymine64.exe': '',
|
|
2058
|
-
'goland.exe': '',
|
|
2059
|
-
'goland64.exe': '',
|
|
2060
|
-
'rider.exe': '',
|
|
2061
|
-
'rider64.exe': ''
|
|
2062
|
-
}
|
|
2063
|
-
}, COMMON_EDITOR_PROCESS_MAP = {
|
|
2064
|
-
darwin: {
|
|
2065
|
-
cursor: [
|
|
2066
|
-
'/Cursor.app/Contents/MacOS/Cursor'
|
|
2067
|
-
],
|
|
2068
|
-
comate: [
|
|
2069
|
-
'/Comate.app/Contents/MacOS/Electron'
|
|
2070
|
-
],
|
|
2071
|
-
windsurf: [
|
|
2072
|
-
'/Windsurf.app/Contents/MacOS/Electron'
|
|
2073
|
-
],
|
|
2074
|
-
trae: [
|
|
2075
|
-
'/Trae.app/Contents/MacOS/Electron',
|
|
2076
|
-
'/Trae CN.app/Contents/MacOS/Electron'
|
|
2077
|
-
],
|
|
2078
|
-
code: [
|
|
2079
|
-
'/Visual Studio Code.app/Contents/MacOS/Electron'
|
|
2080
|
-
],
|
|
2081
|
-
'code-insiders': [
|
|
2082
|
-
'/Visual Studio Code - Insiders.app/Contents/MacOS/Electron'
|
|
2083
|
-
],
|
|
2084
|
-
webstorm: [
|
|
2085
|
-
'/WebStorm.app/Contents/MacOS/webstorm'
|
|
2086
|
-
],
|
|
2087
|
-
atom: [
|
|
2088
|
-
'/Atom.app/Contents/MacOS/Atom'
|
|
2089
|
-
],
|
|
2090
|
-
hbuilder: [
|
|
2091
|
-
'/HBuilderX.app/Contents/MacOS/HBuilderX'
|
|
2092
|
-
],
|
|
2093
|
-
phpstorm: [
|
|
2094
|
-
'/PhpStorm.app/Contents/MacOS/phpstorm'
|
|
2095
|
-
],
|
|
2096
|
-
pycharm: [
|
|
2097
|
-
'/PyCharm.app/Contents/MacOS/pycharm'
|
|
2098
|
-
],
|
|
2099
|
-
idea: [
|
|
2100
|
-
'/IntelliJ IDEA.app/Contents/MacOS/idea'
|
|
2101
|
-
],
|
|
2102
|
-
codium: [
|
|
2103
|
-
'/VSCodium.app/Contents/MacOS/Electron'
|
|
2104
|
-
],
|
|
2105
|
-
goland: [
|
|
2106
|
-
'/GoLand.app/Contents/MacOS/goland'
|
|
2107
|
-
],
|
|
2108
|
-
colin: [
|
|
2109
|
-
'/CLion.app/Contents/MacOS/clion'
|
|
2110
|
-
],
|
|
2111
|
-
appcode: [
|
|
2112
|
-
'/AppCode.app/Contents/MacOS/appcode'
|
|
2113
|
-
],
|
|
2114
|
-
'atom-beta': [
|
|
2115
|
-
'/Atom Beta.app/Contents/MacOS/Atom Beta'
|
|
2116
|
-
],
|
|
2117
|
-
brackets: [
|
|
2118
|
-
'/Brackets.app/Contents/MacOS/Brackets'
|
|
2119
|
-
],
|
|
2120
|
-
rider: [
|
|
2121
|
-
'/Rider.app/Contents/MacOS/rider'
|
|
2122
|
-
],
|
|
2123
|
-
rubymine: [
|
|
2124
|
-
'/RubyMine.app/Contents/MacOS/rubymine'
|
|
2125
|
-
],
|
|
2126
|
-
sublime: [
|
|
2127
|
-
'/Sublime Text.app/Contents/MacOS/sublime_text'
|
|
2128
|
-
],
|
|
2129
|
-
zed: [
|
|
2130
|
-
'/Zed.app/Contents/MacOS/zed'
|
|
2131
|
-
]
|
|
2132
|
-
},
|
|
2133
|
-
linux: {
|
|
2134
|
-
code: [
|
|
2135
|
-
'code'
|
|
2136
|
-
],
|
|
2137
|
-
'code-insiders': [
|
|
2138
|
-
'code-insiders'
|
|
2139
|
-
],
|
|
2140
|
-
webstorm: [
|
|
2141
|
-
'webstorm',
|
|
2142
|
-
'webstorm.sh'
|
|
2143
|
-
],
|
|
2144
|
-
cursor: [
|
|
2145
|
-
'cursor'
|
|
2146
|
-
],
|
|
2147
|
-
windsurf: [
|
|
2148
|
-
'windsurf'
|
|
2149
|
-
],
|
|
2150
|
-
atom: [
|
|
2151
|
-
'atom'
|
|
2152
|
-
],
|
|
2153
|
-
hbuilder: [
|
|
2154
|
-
'hbuilderx',
|
|
2155
|
-
'hbuilderx.sh'
|
|
2156
|
-
],
|
|
2157
|
-
phpstorm: [
|
|
2158
|
-
'phpstorm',
|
|
2159
|
-
'phpstorm.sh'
|
|
2160
|
-
],
|
|
2161
|
-
pycharm: [
|
|
2162
|
-
'pycharm',
|
|
2163
|
-
'pycharm.sh'
|
|
2164
|
-
],
|
|
2165
|
-
idea: [
|
|
2166
|
-
'idea',
|
|
2167
|
-
'idea.sh'
|
|
2168
|
-
],
|
|
2169
|
-
codium: [
|
|
2170
|
-
'vscodium'
|
|
2171
|
-
],
|
|
2172
|
-
goland: [
|
|
2173
|
-
'goland'
|
|
2174
|
-
],
|
|
2175
|
-
brackets: [
|
|
2176
|
-
'Brackets'
|
|
2177
|
-
],
|
|
2178
|
-
rider: [
|
|
2179
|
-
'rider'
|
|
2180
|
-
],
|
|
2181
|
-
rubymine: [
|
|
2182
|
-
'rubymine',
|
|
2183
|
-
'rubymine.sh'
|
|
2184
|
-
],
|
|
2185
|
-
sublime: [
|
|
2186
|
-
'sublime_text'
|
|
2187
|
-
],
|
|
2188
|
-
vim: [
|
|
2189
|
-
'vim'
|
|
2190
|
-
],
|
|
2191
|
-
emacs: [
|
|
2192
|
-
'emacs'
|
|
2193
|
-
]
|
|
2194
|
-
},
|
|
2195
|
-
win32: {
|
|
2196
|
-
code: [
|
|
2197
|
-
'Code.exe'
|
|
2198
|
-
],
|
|
2199
|
-
'code-insiders': [
|
|
2200
|
-
'Code - Insiders.exe'
|
|
2201
|
-
],
|
|
2202
|
-
webstorm: [
|
|
2203
|
-
'webstorm.exe',
|
|
2204
|
-
'webstorm64.exe'
|
|
2205
|
-
],
|
|
2206
|
-
cursor: [
|
|
2207
|
-
'Cursor.exe'
|
|
2208
|
-
],
|
|
2209
|
-
windsurf: [
|
|
2210
|
-
'Windsurf.exe'
|
|
2211
|
-
],
|
|
2212
|
-
trae: [
|
|
2213
|
-
'Trae.exe',
|
|
2214
|
-
'Trae CN.exe'
|
|
2215
|
-
],
|
|
2216
|
-
comate: [
|
|
2217
|
-
'comate.exe'
|
|
2218
|
-
],
|
|
2219
|
-
atom: [
|
|
2220
|
-
'atom.exe'
|
|
2221
|
-
],
|
|
2222
|
-
hbuilder: [
|
|
2223
|
-
'HBuilderX.exe',
|
|
2224
|
-
'HBuilder.exe',
|
|
2225
|
-
'HBuilderX64.exe',
|
|
2226
|
-
'HBuilder64.exe'
|
|
2227
|
-
],
|
|
2228
|
-
phpstorm: [
|
|
2229
|
-
'phpstorm.exe',
|
|
2230
|
-
'phpstorm64.exe'
|
|
2231
|
-
],
|
|
2232
|
-
pycharm: [
|
|
2233
|
-
'pycharm.exe',
|
|
2234
|
-
'pycharm64.exe'
|
|
2235
|
-
],
|
|
2236
|
-
idea: [
|
|
2237
|
-
'idea.exe',
|
|
2238
|
-
'idea64.exe'
|
|
2239
|
-
],
|
|
2240
|
-
codium: [
|
|
2241
|
-
'VSCodium.exe'
|
|
2242
|
-
],
|
|
2243
|
-
goland: [
|
|
2244
|
-
'goland.exe',
|
|
2245
|
-
'goland64.exe'
|
|
2246
|
-
],
|
|
2247
|
-
colin: [
|
|
2248
|
-
'clion.exe',
|
|
2249
|
-
'clion64.exe'
|
|
2250
|
-
],
|
|
2251
|
-
brackets: [
|
|
2252
|
-
'Brackets.exe'
|
|
2253
|
-
],
|
|
2254
|
-
rider: [
|
|
2255
|
-
'rider.exe',
|
|
2256
|
-
'rider64.exe'
|
|
2257
|
-
],
|
|
2258
|
-
rubymine: [
|
|
2259
|
-
'rubymine.exe',
|
|
2260
|
-
'rubymine64.exe'
|
|
2261
|
-
],
|
|
2262
|
-
sublime: [
|
|
2263
|
-
'sublime_text.exe'
|
|
2264
|
-
],
|
|
2265
|
-
notepad: [
|
|
2266
|
-
'notepad++.exe'
|
|
2267
|
-
]
|
|
2268
|
-
}
|
|
2269
|
-
}, FormatFile = '{file}', FormatLine = '{line}', FormatColumn = '{column}', processExecutionMap = {
|
|
2270
|
-
darwin: 'ps ax -o comm=',
|
|
2271
|
-
linux: 'ps -eo comm --sort=comm',
|
|
2272
|
-
win32: 'wmic process where "executablepath is not null" get executablepath'
|
|
2273
|
-
}, compatibleWithChineseCharacter = (isWin32)=>{
|
|
2274
|
-
if (isWin32) try {
|
|
2275
|
-
external_node_child_process_default().execSync('chcp 65001');
|
|
2276
|
-
} catch {}
|
|
2277
|
-
}, _childProcess = null, positionRE = /:(\d+)(:(\d+))?$/;
|
|
2278
|
-
function launchEditor(file, options) {
|
|
2279
|
-
var cb, method;
|
|
2280
|
-
let { editor: specifiedEditor, method: method1, onError } = options || {}, parsed = function(file) {
|
|
2281
|
-
let _file = file;
|
|
2282
|
-
_file.startsWith('file://') && (_file = __webpack_require__("node:url").fileURLToPath(_file));
|
|
2283
|
-
let fileName = _file.replace(positionRE, ''), match = _file.match(positionRE), lineNumber = (null == match ? void 0 : match[1]) || 1;
|
|
2284
|
-
return {
|
|
2285
|
-
fileName,
|
|
2286
|
-
lineNumber,
|
|
2287
|
-
columnNumber: (null == match ? void 0 : match[3]) || 1
|
|
2288
|
-
};
|
|
2289
|
-
}(file), { fileName } = parsed, { lineNumber, columnNumber } = parsed;
|
|
2290
|
-
if (!external_node_fs_default().existsSync(fileName)) return;
|
|
2291
|
-
let onErrorCallback = (cb = onError, (fileName, errorMessage)=>{
|
|
2292
|
-
if (console.log(), console.log(colors.red('Could not open ' + external_node_path_default().basename(fileName) + ' in the editor.')), errorMessage) {
|
|
2293
|
-
let displayErrorMessage = errorMessage;
|
|
2294
|
-
'.' !== displayErrorMessage[displayErrorMessage.length - 1] && (displayErrorMessage += '.'), console.log(colors.red('The editor process exited with an error: ' + displayErrorMessage));
|
|
2295
|
-
}
|
|
2296
|
-
console.log(), cb && cb(fileName, errorMessage);
|
|
2297
|
-
}), [editor, ...args] = function(specifiedEditor) {
|
|
2298
|
-
let platform = process.platform;
|
|
2299
|
-
if (specifiedEditor) {
|
|
2300
|
-
var _COMMON_EDITOR_PROCESS_MAP_platform;
|
|
2301
|
-
let editor = null == (_COMMON_EDITOR_PROCESS_MAP_platform = COMMON_EDITOR_PROCESS_MAP[platform]) ? void 0 : _COMMON_EDITOR_PROCESS_MAP_platform[specifiedEditor];
|
|
2302
|
-
if (editor) return editor;
|
|
2303
|
-
}
|
|
2304
|
-
let editorFromPid = function() {
|
|
2305
|
-
let platform = process.platform, editorNames = Object.keys(COMMON_EDITORS_MAP[platform]);
|
|
2306
|
-
try {
|
|
2307
|
-
return function(pid, platform, editorNames) {
|
|
2308
|
-
let depth = 0, currentPid = pid;
|
|
2309
|
-
for(; currentPid && 0 !== currentPid && depth < 50;){
|
|
2310
|
-
let processInfo = function(pid, platform) {
|
|
2311
|
-
switch(platform){
|
|
2312
|
-
case 'darwin':
|
|
2313
|
-
case 'linux':
|
|
2314
|
-
var pid1, pid2 = pid;
|
|
2315
|
-
try {
|
|
2316
|
-
let lines = external_node_child_process_default().execSync(`ps -p ${pid2} -o ppid=,comm=`, {
|
|
2317
|
-
encoding: 'utf8'
|
|
2318
|
-
}).trim().split('\n');
|
|
2319
|
-
if (!lines.length) return null;
|
|
2320
|
-
var processLine = lines[0].trim();
|
|
2321
|
-
let match = processLine.match(/^(\d+)\s+(.+)$/);
|
|
2322
|
-
return match ? {
|
|
2323
|
-
command: match[2],
|
|
2324
|
-
parentPid: Number.parseInt(match[1])
|
|
2325
|
-
} : null;
|
|
2326
|
-
} catch {
|
|
2327
|
-
return null;
|
|
2328
|
-
}
|
|
2329
|
-
case 'win32':
|
|
2330
|
-
return pid1 = pid, function(pid) {
|
|
2331
|
-
try {
|
|
2332
|
-
compatibleWithChineseCharacter(!0);
|
|
2333
|
-
let lines = external_node_child_process_default().execSync(`wmic process where "ProcessId=${pid}" get ParentProcessId,ExecutablePath /format:csv`, {
|
|
2334
|
-
encoding: 'utf8'
|
|
2335
|
-
}).trim().split('\r\n').filter((line)=>line.trim()).slice(1);
|
|
2336
|
-
if (0 === lines.length) return null;
|
|
2337
|
-
let parts = lines[0].split(',');
|
|
2338
|
-
if (parts.length < 3) return null;
|
|
2339
|
-
return {
|
|
2340
|
-
command: parts[1].trim(),
|
|
2341
|
-
parentPid: Number.parseInt(parts[2].trim())
|
|
2342
|
-
};
|
|
2343
|
-
} catch {
|
|
2344
|
-
return null;
|
|
2345
|
-
}
|
|
2346
|
-
}(pid1) || function(pid) {
|
|
2347
|
-
try {
|
|
2348
|
-
compatibleWithChineseCharacter(!0);
|
|
2349
|
-
let line = external_node_child_process_default().execSync(`powershell -NoProfile -Command "Get-CimInstance -Query \"select ParentProcessId,ExecutablePath from win32_process where ProcessId=${pid}\" | ForEach-Object { $_.ExecutablePath + ',' + $_.ParentProcessId }"`, {
|
|
2350
|
-
encoding: 'utf8'
|
|
2351
|
-
}).trim();
|
|
2352
|
-
if (!line) return null;
|
|
2353
|
-
let parts = line.split(',');
|
|
2354
|
-
if (parts.length < 2) return null;
|
|
2355
|
-
return {
|
|
2356
|
-
command: parts[0].trim(),
|
|
2357
|
-
parentPid: Number.parseInt(parts[1].trim())
|
|
2358
|
-
};
|
|
2359
|
-
} catch {
|
|
2360
|
-
return null;
|
|
2361
|
-
}
|
|
2362
|
-
}(pid1);
|
|
2363
|
-
default:
|
|
2364
|
-
return null;
|
|
2365
|
-
}
|
|
2366
|
-
}(currentPid, platform);
|
|
2367
|
-
if (!processInfo) break;
|
|
2368
|
-
let { command, parentPid } = processInfo;
|
|
2369
|
-
if (function(command, editorNames) {
|
|
2370
|
-
return editorNames.some((editorName)=>command.toLowerCase().endsWith(editorName.toLowerCase()));
|
|
2371
|
-
}(command, editorNames)) return command;
|
|
2372
|
-
currentPid = parentPid, depth++;
|
|
2373
|
-
}
|
|
2374
|
-
return null;
|
|
2375
|
-
}(process.pid, platform, editorNames);
|
|
2376
|
-
} catch (error) {
|
|
2377
|
-
return console.error('Error while getting editor by PID:', error), null;
|
|
2378
|
-
}
|
|
2379
|
-
}();
|
|
2380
|
-
if (editorFromPid) return [
|
|
2381
|
-
editorFromPid
|
|
2382
|
-
];
|
|
2383
|
-
try {
|
|
2384
|
-
let first, isWin32 = 'win32' === process.platform, execution = processExecutionMap[platform], commonEditors = COMMON_EDITORS_MAP[platform];
|
|
2385
|
-
compatibleWithChineseCharacter(isWin32);
|
|
2386
|
-
let output = '';
|
|
2387
|
-
try {
|
|
2388
|
-
output = external_node_child_process_default().execSync(execution, {
|
|
2389
|
-
encoding: 'utf-8'
|
|
2390
|
-
});
|
|
2391
|
-
} catch {
|
|
2392
|
-
isWin32 && (output = external_node_child_process_default().execSync('powershell -NoProfile -Command "Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }"', {
|
|
2393
|
-
encoding: 'utf-8'
|
|
2394
|
-
}));
|
|
2395
|
-
}
|
|
2396
|
-
let editorNames = Object.keys(commonEditors), runningProcesses = output.split(isWin32 ? '\r\n' : '\n').map((item)=>item.trim());
|
|
2397
|
-
for(let i = 0; i < editorNames.length; i++){
|
|
2398
|
-
let editorName = editorNames[i], editor = '', runningEditor = '';
|
|
2399
|
-
if (isWin32) {
|
|
2400
|
-
let processPath = runningProcesses.find((_process)=>external_node_path_default().basename(_process).toLowerCase() === editorName.toLowerCase());
|
|
2401
|
-
processPath && (runningEditor = external_node_path_default().basename(processPath), editor = processPath);
|
|
2402
|
-
} else if ('darwin' === platform) {
|
|
2403
|
-
let runningProcess = runningProcesses.find((_process)=>_process.toLowerCase().endsWith(editorName.toLowerCase()));
|
|
2404
|
-
if (runningProcess) {
|
|
2405
|
-
let prefixPath = runningProcess.replace(editorName, ''), processName = commonEditors[editorName];
|
|
2406
|
-
runningEditor = editorName, editor = processName.includes('/') ? `${prefixPath}${processName}` : processName;
|
|
2407
|
-
}
|
|
2408
|
-
} else -1 !== output.indexOf(editorName) && (runningEditor = editorName, editor = commonEditors[editorName]);
|
|
2409
|
-
if (runningEditor && editor && !first) {
|
|
2410
|
-
first = [
|
|
2411
|
-
editor
|
|
2412
|
-
];
|
|
2413
|
-
break;
|
|
2414
|
-
}
|
|
2415
|
-
}
|
|
2416
|
-
if (first) return first;
|
|
2417
|
-
} catch {}
|
|
2418
|
-
return process.env.VISUAL ? [
|
|
2419
|
-
process.env.VISUAL
|
|
2420
|
-
] : process.env.EDITOR ? [
|
|
2421
|
-
process.env.EDITOR
|
|
2422
|
-
] : [];
|
|
2423
|
-
}(specifiedEditor);
|
|
2424
|
-
if (!editor) return void onErrorCallback(fileName);
|
|
2425
|
-
if ('linux' === process.platform && fileName.startsWith('/mnt/') && /Microsoft/i.test(external_node_os_default().release()) && (fileName = external_node_path_default().relative('', fileName)), args = args.concat(function({ processName, fileName, lineNumber, columnNumber, workspace, openMethodArgs }) {
|
|
2426
|
-
let format = function({ editorBasename, openMethodArgs, workspace }) {
|
|
2427
|
-
switch(editorBasename){
|
|
2428
|
-
case 'atom':
|
|
2429
|
-
case 'atom beta':
|
|
2430
|
-
case 'subl':
|
|
2431
|
-
case 'sublime':
|
|
2432
|
-
case 'sublime_text':
|
|
2433
|
-
case 'wstorm':
|
|
2434
|
-
case 'charm':
|
|
2435
|
-
case 'zed':
|
|
2436
|
-
return `${FormatFile}:${FormatLine}:${FormatColumn}`;
|
|
2437
|
-
case 'notepad++':
|
|
2438
|
-
return [
|
|
2439
|
-
'-n' + FormatLine,
|
|
2440
|
-
'-c' + FormatColumn,
|
|
2441
|
-
FormatFile
|
|
2442
|
-
];
|
|
2443
|
-
case 'vim':
|
|
2444
|
-
case 'mvim':
|
|
2445
|
-
return [
|
|
2446
|
-
`+call cursor(${FormatLine}, ${FormatColumn})`,
|
|
2447
|
-
FormatFile
|
|
2448
|
-
];
|
|
2449
|
-
case 'joe':
|
|
2450
|
-
case 'gvim':
|
|
2451
|
-
return [
|
|
2452
|
-
'+' + FormatLine,
|
|
2453
|
-
FormatFile
|
|
2454
|
-
];
|
|
2455
|
-
case 'emacs':
|
|
2456
|
-
case 'emacsclient':
|
|
2457
|
-
return [
|
|
2458
|
-
'+' + FormatLine + ':' + FormatColumn,
|
|
2459
|
-
FormatFile
|
|
2460
|
-
];
|
|
2461
|
-
case 'rmate':
|
|
2462
|
-
case 'mate':
|
|
2463
|
-
case 'mine':
|
|
2464
|
-
return [
|
|
2465
|
-
'--line',
|
|
2466
|
-
FormatLine,
|
|
2467
|
-
FormatFile
|
|
2468
|
-
];
|
|
2469
|
-
case 'code':
|
|
2470
|
-
case 'code-insiders':
|
|
2471
|
-
case 'code - insiders':
|
|
2472
|
-
case 'codium':
|
|
2473
|
-
case 'cursor':
|
|
2474
|
-
case 'windsurf':
|
|
2475
|
-
case 'trae':
|
|
2476
|
-
case 'comate':
|
|
2477
|
-
case 'vscodium':
|
|
2478
|
-
case 'hbuilderx':
|
|
2479
|
-
case 'hbuilder':
|
|
2480
|
-
return [
|
|
2481
|
-
...workspace ? [
|
|
2482
|
-
workspace
|
|
2483
|
-
] : [],
|
|
2484
|
-
'-g',
|
|
2485
|
-
...openMethodArgs ? [
|
|
2486
|
-
openMethodArgs
|
|
2487
|
-
] : [],
|
|
2488
|
-
`${FormatFile}:${FormatLine}:${FormatColumn}`
|
|
2489
|
-
];
|
|
2490
|
-
case 'appcode':
|
|
2491
|
-
case 'clion':
|
|
2492
|
-
case 'clion64':
|
|
2493
|
-
case 'idea':
|
|
2494
|
-
case 'idea64':
|
|
2495
|
-
case 'phpstorm':
|
|
2496
|
-
case 'phpstorm64':
|
|
2497
|
-
case 'pycharm':
|
|
2498
|
-
case 'pycharm64':
|
|
2499
|
-
case 'rubymine':
|
|
2500
|
-
case 'rubymine64':
|
|
2501
|
-
case 'webstorm':
|
|
2502
|
-
case 'webstorm64':
|
|
2503
|
-
case 'goland':
|
|
2504
|
-
case 'goland64':
|
|
2505
|
-
case 'rider':
|
|
2506
|
-
case 'rider64':
|
|
2507
|
-
return [
|
|
2508
|
-
...workspace ? [
|
|
2509
|
-
workspace
|
|
2510
|
-
] : [],
|
|
2511
|
-
'--line',
|
|
2512
|
-
FormatLine,
|
|
2513
|
-
FormatFile
|
|
2514
|
-
];
|
|
2515
|
-
}
|
|
2516
|
-
return '';
|
|
2517
|
-
}({
|
|
2518
|
-
editorBasename: function(processName) {
|
|
2519
|
-
let editorBasename = external_node_path_default().basename(processName).replace(/\.(exe|cmd|bat|sh)$/i, ''), platform = process.platform, editorBasenameList = Object.keys(COMMON_EDITOR_PROCESS_MAP[platform]);
|
|
2520
|
-
for(let i = 0; i < editorBasenameList.length; i++)if ((COMMON_EDITOR_PROCESS_MAP[platform][editorBasenameList[i]] || []).some((editorPath)=>processName.endsWith(editorPath))) {
|
|
2521
|
-
editorBasename = editorBasenameList[i];
|
|
2522
|
-
break;
|
|
2523
|
-
}
|
|
2524
|
-
return editorBasename.toLowerCase();
|
|
2525
|
-
}(processName),
|
|
2526
|
-
openMethodArgs,
|
|
2527
|
-
workspace
|
|
2528
|
-
}) || '{file}';
|
|
2529
|
-
var file = fileName, line = lineNumber, column = columnNumber, format1 = format;
|
|
2530
|
-
let formattedPath = `${file}:${line}:${column}`;
|
|
2531
|
-
if ('string' == typeof format1) formattedPath = format1.replace(FormatFile, file).replace(FormatLine, line.toString()).replace(FormatColumn, column.toString());
|
|
2532
|
-
else if (Array.isArray(format1)) return format1.map((item)=>item.replace(FormatFile, file).replace(FormatLine, line.toString()).replace(FormatColumn, column.toString()));
|
|
2533
|
-
return [
|
|
2534
|
-
formattedPath
|
|
2535
|
-
];
|
|
2536
|
-
}({
|
|
2537
|
-
processName: editor,
|
|
2538
|
-
fileName,
|
|
2539
|
-
lineNumber,
|
|
2540
|
-
columnNumber,
|
|
2541
|
-
workspace: null,
|
|
2542
|
-
openMethodArgs: 'reuse' === (method = method1) ? '-r' : 'new' === method ? '-n' : ''
|
|
2543
|
-
})), _childProcess && function(editor) {
|
|
2544
|
-
switch(editor){
|
|
2545
|
-
case 'vim':
|
|
2546
|
-
case 'emacs':
|
|
2547
|
-
case 'nano':
|
|
2548
|
-
return !0;
|
|
2549
|
-
}
|
|
2550
|
-
return !1;
|
|
2551
|
-
}(editor) && _childProcess.kill('SIGKILL'), 'win32' === process.platform) {
|
|
2552
|
-
let launchCommand = [
|
|
2553
|
-
editor,
|
|
2554
|
-
...args.map((cmdArgs)=>cmdArgs.replace(/([&|<>,;=^])/g, '^$1'))
|
|
2555
|
-
].map((str)=>str.includes('^') ? `^"${str}^"` : str.includes(' ') ? `"${str}"` : str).join(' ');
|
|
2556
|
-
_childProcess = external_node_child_process_default().exec(launchCommand, {
|
|
2557
|
-
shell: !0
|
|
2558
|
-
});
|
|
2559
|
-
} else _childProcess = external_node_child_process_default().spawn(editor, args);
|
|
2560
|
-
_childProcess.on('exit', (errorCode)=>{
|
|
2561
|
-
_childProcess = null, errorCode && onErrorCallback(fileName, '(code ' + errorCode + ')');
|
|
2562
|
-
}), _childProcess.on('error', (error)=>{
|
|
2563
|
-
let { message } = error;
|
|
2564
|
-
onErrorCallback(fileName, message);
|
|
2565
|
-
});
|
|
2566
|
-
}
|
|
2567
1983
|
let external_chokidar_namespaceObject = require("chokidar");
|
|
2568
1984
|
var external_chokidar_default = __webpack_require__.n(external_chokidar_namespaceObject);
|
|
2569
1985
|
let GLOB_REGEX = /[*?{}[\]()!@+|]/;
|
|
@@ -2582,7 +1998,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2582
1998
|
...options
|
|
2583
1999
|
});
|
|
2584
2000
|
}
|
|
2585
|
-
})(), exports.CSS_MODULES_LOCAL_IDENT_NAME = __webpack_exports__.CSS_MODULES_LOCAL_IDENT_NAME, exports.CSS_MODULES_REGEX = __webpack_exports__.CSS_MODULES_REGEX, exports.CSS_NAMED_EXPORT = __webpack_exports__.CSS_NAMED_EXPORT, exports.DEFAULT_DEV_HOST = __webpack_exports__.DEFAULT_DEV_HOST, exports.DEV_DEFAULT_FILENAME = __webpack_exports__.DEV_DEFAULT_FILENAME, exports.EXPORT_LOCALS_CONVENTION = __webpack_exports__.EXPORT_LOCALS_CONVENTION, exports.LogColor = __webpack_exports__.LogColor, exports.NODE_MODULES_REGEX = __webpack_exports__.NODE_MODULES_REGEX, exports.PROD_DEFAULT_FILENAME = __webpack_exports__.PROD_DEFAULT_FILENAME, exports.TEMPLATE_CONTENT = __webpack_exports__.TEMPLATE_CONTENT, exports.TEMP_DIR = __webpack_exports__.TEMP_DIR, exports.THREAD_OPTIONS = __webpack_exports__.THREAD_OPTIONS, exports.clearLine = __webpack_exports__.clearLine, exports.colors = __webpack_exports__.colors, exports.createChokidar = __webpack_exports__.createChokidar, exports.createUnpack = __webpack_exports__.createUnpack, exports.debounce = __webpack_exports__.debounce, exports.defineConfig = __webpack_exports__.defineConfig, exports.esVersionToBrowserslist = __webpack_exports__.esVersionToBrowserslist, exports.findExists = __webpack_exports__.findExists, exports.getAddressUrls = __webpack_exports__.getAddressUrls, exports.getCompiledPkgPath = __webpack_exports__.getCompiledPkgPath, exports.getIpv4Interfaces = __webpack_exports__.getIpv4Interfaces, exports.getNodeEnv = __webpack_exports__.getNodeEnv, exports.getPathInJs = __webpack_exports__.getPathInJs, exports.getPort = __webpack_exports__.getPort, exports.getTime = __webpack_exports__.getTime, exports.getUserDepPath = __webpack_exports__.getUserDepPath, exports.getUserDepVersion = __webpack_exports__.getUserDepVersion, exports.getValueByPath = __webpack_exports__.getValueByPath, exports.isBoolean = __webpack_exports__.isBoolean, exports.isCI = __webpack_exports__.isCI, exports.isCSSModules = __webpack_exports__.isCSSModules, exports.isDebug = __webpack_exports__.isDebug, exports.isDev = __webpack_exports__.isDev, exports.isDevServer = __webpack_exports__.isDevServer, exports.isEmptyDir = __webpack_exports__.isEmptyDir, exports.isFileExists = __webpack_exports__.isFileExists, exports.isFileSync = __webpack_exports__.isFileSync, exports.isFunction = __webpack_exports__.isFunction, exports.isNodeVersionAtLeast = __webpack_exports__.isNodeVersionAtLeast, exports.isObject = __webpack_exports__.isObject, exports.isPlainObject = __webpack_exports__.isPlainObject, exports.isProd = __webpack_exports__.isProd, exports.isRegExp = __webpack_exports__.isRegExp, exports.isString = __webpack_exports__.isString, exports.isUndefined = __webpack_exports__.isUndefined, exports.isWatch = __webpack_exports__.isWatch, exports.isWin = __webpack_exports__.isWin, exports.
|
|
2001
|
+
})(), exports.CSS_MODULES_LOCAL_IDENT_NAME = __webpack_exports__.CSS_MODULES_LOCAL_IDENT_NAME, exports.CSS_MODULES_REGEX = __webpack_exports__.CSS_MODULES_REGEX, exports.CSS_NAMED_EXPORT = __webpack_exports__.CSS_NAMED_EXPORT, exports.DEFAULT_DEV_HOST = __webpack_exports__.DEFAULT_DEV_HOST, exports.DEV_DEFAULT_FILENAME = __webpack_exports__.DEV_DEFAULT_FILENAME, exports.EXPORT_LOCALS_CONVENTION = __webpack_exports__.EXPORT_LOCALS_CONVENTION, exports.LogColor = __webpack_exports__.LogColor, exports.NODE_MODULES_REGEX = __webpack_exports__.NODE_MODULES_REGEX, exports.PROD_DEFAULT_FILENAME = __webpack_exports__.PROD_DEFAULT_FILENAME, exports.TEMPLATE_CONTENT = __webpack_exports__.TEMPLATE_CONTENT, exports.TEMP_DIR = __webpack_exports__.TEMP_DIR, exports.THREAD_OPTIONS = __webpack_exports__.THREAD_OPTIONS, exports.clearLine = __webpack_exports__.clearLine, exports.colors = __webpack_exports__.colors, exports.createChokidar = __webpack_exports__.createChokidar, exports.createUnpack = __webpack_exports__.createUnpack, exports.debounce = __webpack_exports__.debounce, exports.defineConfig = __webpack_exports__.defineConfig, exports.esVersionToBrowserslist = __webpack_exports__.esVersionToBrowserslist, exports.findExists = __webpack_exports__.findExists, exports.getAddressUrls = __webpack_exports__.getAddressUrls, exports.getCompiledPkgPath = __webpack_exports__.getCompiledPkgPath, exports.getIpv4Interfaces = __webpack_exports__.getIpv4Interfaces, exports.getNodeEnv = __webpack_exports__.getNodeEnv, exports.getPathInJs = __webpack_exports__.getPathInJs, exports.getPort = __webpack_exports__.getPort, exports.getTime = __webpack_exports__.getTime, exports.getUserDepPath = __webpack_exports__.getUserDepPath, exports.getUserDepVersion = __webpack_exports__.getUserDepVersion, exports.getValueByPath = __webpack_exports__.getValueByPath, exports.isBoolean = __webpack_exports__.isBoolean, exports.isCI = __webpack_exports__.isCI, exports.isCSSModules = __webpack_exports__.isCSSModules, exports.isDebug = __webpack_exports__.isDebug, exports.isDev = __webpack_exports__.isDev, exports.isDevServer = __webpack_exports__.isDevServer, exports.isEmptyDir = __webpack_exports__.isEmptyDir, exports.isFileExists = __webpack_exports__.isFileExists, exports.isFileSync = __webpack_exports__.isFileSync, exports.isFunction = __webpack_exports__.isFunction, exports.isNodeVersionAtLeast = __webpack_exports__.isNodeVersionAtLeast, exports.isObject = __webpack_exports__.isObject, exports.isPlainObject = __webpack_exports__.isPlainObject, exports.isProd = __webpack_exports__.isProd, exports.isRegExp = __webpack_exports__.isRegExp, exports.isString = __webpack_exports__.isString, exports.isUndefined = __webpack_exports__.isUndefined, exports.isWatch = __webpack_exports__.isWatch, exports.isWin = __webpack_exports__.isWin, exports.loadConfig = __webpack_exports__.loadConfig, exports.logUpdate = __webpack_exports__.logUpdate, exports.logger = __webpack_exports__.logger, exports.mergeConfig = __webpack_exports__.mergeConfig, exports.pathExists = __webpack_exports__.pathExists, exports.prettyTime = __webpack_exports__.prettyTime, exports.removeDir = __webpack_exports__.removeDir, exports.resolveConfigPath = __webpack_exports__.resolveConfigPath, exports.restartCleaners = __webpack_exports__.restartCleaners, exports.rspack = __webpack_exports__.rspack, exports.setDevServer = __webpack_exports__.setDevServer, exports.setNodeEnv = __webpack_exports__.setNodeEnv, exports.setValueByPath = __webpack_exports__.setValueByPath, exports.trackPerformance = __webpack_exports__.trackPerformance, __webpack_exports__)-1 === [
|
|
2586
2002
|
"CSS_MODULES_LOCAL_IDENT_NAME",
|
|
2587
2003
|
"CSS_MODULES_REGEX",
|
|
2588
2004
|
"CSS_NAMED_EXPORT",
|
|
@@ -2632,7 +2048,6 @@ for(var __webpack_i__ in (()=>{
|
|
|
2632
2048
|
"isUndefined",
|
|
2633
2049
|
"isWatch",
|
|
2634
2050
|
"isWin",
|
|
2635
|
-
"launchEditor",
|
|
2636
2051
|
"loadConfig",
|
|
2637
2052
|
"logUpdate",
|
|
2638
2053
|
"logger",
|