Convert extension webpack scripts to modules

This commit is contained in:
Matt Bierner
2025-08-07 17:20:22 -07:00
parent 86ff5cd43b
commit ed71020bfc
58 changed files with 303 additions and 527 deletions

View File

@@ -522,7 +522,7 @@ async function webpackExtensions(taskName, isWatch, webpackConfigLocations) {
const webpack = require('webpack'); const webpack = require('webpack');
const webpackConfigs = []; const webpackConfigs = [];
for (const { configPath, outputRoot } of webpackConfigLocations) { for (const { configPath, outputRoot } of webpackConfigLocations) {
const configOrFnOrArray = require(configPath); const configOrFnOrArray = require(configPath).default;
function addConfig(configOrFnOrArray) { function addConfig(configOrFnOrArray) {
for (const configOrFn of Array.isArray(configOrFnOrArray) ? configOrFnOrArray : [configOrFnOrArray]) { for (const configOrFn of Array.isArray(configOrFnOrArray) ? configOrFnOrArray : [configOrFnOrArray]) {
const config = typeof configOrFn === 'function' ? configOrFn({}, {}) : configOrFn; const config = typeof configOrFn === 'function' ? configOrFn({}, {}) : configOrFn;

View File

@@ -575,7 +575,7 @@ export async function webpackExtensions(taskName: string, isWatch: boolean, webp
const webpackConfigs: webpack.Configuration[] = []; const webpackConfigs: webpack.Configuration[] = [];
for (const { configPath, outputRoot } of webpackConfigLocations) { for (const { configPath, outputRoot } of webpackConfigLocations) {
const configOrFnOrArray = require(configPath); const configOrFnOrArray = require(configPath).default;
function addConfig(configOrFnOrArray: webpack.Configuration | ((env: unknown, args: unknown) => webpack.Configuration) | webpack.Configuration[]) { function addConfig(configOrFnOrArray: webpack.Configuration | ((env: unknown, args: unknown) => webpack.Configuration) | webpack.Configuration[]) {
for (const configOrFn of Array.isArray(configOrFnOrArray) ? configOrFnOrArray : [configOrFnOrArray]) { for (const configOrFn of Array.isArray(configOrFnOrArray) ? configOrFnOrArray : [configOrFnOrArray]) {
const config = typeof configOrFn === 'function' ? configOrFn({}, {}) : configOrFn; const config = typeof configOrFn === 'function' ? configOrFn({}, {}) : configOrFn;
@@ -587,6 +587,7 @@ export async function webpackExtensions(taskName: string, isWatch: boolean, webp
} }
addConfig(configOrFnOrArray); addConfig(configOrFnOrArray);
} }
function reporter(fullStats: any) { function reporter(fullStats: any) {
if (Array.isArray(fullStats.children)) { if (Array.isArray(fullStats.children)) {
for (const stats of fullStats.children) { for (const stats of fullStats.children) {

View File

@@ -2,16 +2,12 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import path from 'path';
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
//@ts-check export default withBrowserDefaults({
context: import.meta.dirname,
'use strict';
const path = require('path');
const withBrowserDefaults = require('../shared.webpack.config').browser;
module.exports = withBrowserDefaults({
context: __dirname,
entry: { entry: {
extension: './src/configurationEditingMain.ts' extension: './src/configurationEditingMain.ts'
}, },
@@ -20,7 +16,7 @@ module.exports = withBrowserDefaults({
}, },
resolve: { resolve: {
alias: { alias: {
'./node/net': path.resolve(__dirname, 'src', 'browser', 'net'), './node/net': path.resolve(import.meta.dirname, 'src', 'browser', 'net'),
} }
} }
}); });

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
extension: './src/configurationEditingMain.ts', extension: './src/configurationEditingMain.ts',
}, },

View File

@@ -2,21 +2,17 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
import path from 'path';
//@ts-check export default withBrowserDefaults({
context: path.join(import.meta.dirname, 'client'),
'use strict';
const withBrowserDefaults = require('../shared.webpack.config').browser;
const path = require('path');
module.exports = withBrowserDefaults({
context: path.join(__dirname, 'client'),
entry: { entry: {
extension: './src/browser/cssClientMain.ts' extension: './src/browser/cssClientMain.ts'
}, },
output: { output: {
filename: 'cssClientMain.js', filename: 'cssClientMain.js',
path: path.join(__dirname, 'client', 'dist', 'browser') path: path.join(import.meta.dirname, 'client', 'dist', 'browser')
} }
}); });

View File

@@ -2,21 +2,17 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
import path from 'path';
//@ts-check export default withDefaults({
context: path.join(import.meta.dirname, 'client'),
'use strict';
const withDefaults = require('../shared.webpack.config');
const path = require('path');
module.exports = withDefaults({
context: path.join(__dirname, 'client'),
entry: { entry: {
extension: './src/node/cssClientMain.ts', extension: './src/node/cssClientMain.ts',
}, },
output: { output: {
filename: 'cssClientMain.js', filename: 'cssClientMain.js',
path: path.join(__dirname, 'client', 'dist', 'node') path: path.join(import.meta.dirname, 'client', 'dist', 'node')
} }
}); });

View File

@@ -2,22 +2,18 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import { browser as withBrowserDefaults } from '../../shared.webpack.config.mjs';
import path from 'path';
//@ts-check export default withBrowserDefaults({
context: import.meta.dirname,
'use strict';
const withBrowserDefaults = require('../../shared.webpack.config').browser;
const path = require('path');
module.exports = withBrowserDefaults({
context: __dirname,
entry: { entry: {
extension: './src/browser/cssServerWorkerMain.ts', extension: './src/browser/cssServerWorkerMain.ts',
}, },
output: { output: {
filename: 'cssServerMain.js', filename: 'cssServerMain.js',
path: path.join(__dirname, 'dist', 'browser'), path: path.join(import.meta.dirname, 'dist', 'browser'),
libraryTarget: 'var', libraryTarget: 'var',
library: 'serverExportVar' library: 'serverExportVar'
} }

View File

@@ -2,21 +2,17 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../../shared.webpack.config.mjs';
import path from 'path';
//@ts-check export default withDefaults({
context: path.join(import.meta.dirname),
'use strict';
const withDefaults = require('../../shared.webpack.config');
const path = require('path');
module.exports = withDefaults({
context: path.join(__dirname),
entry: { entry: {
extension: './src/node/cssServerNodeMain.ts', extension: './src/node/cssServerNodeMain.ts',
}, },
output: { output: {
filename: 'cssServerMain.js', filename: 'cssServerMain.js',
path: path.join(__dirname, 'dist', 'node'), path: path.join(import.meta.dirname, 'dist', 'node'),
} }
}); });

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
extension: './src/extension.ts', extension: './src/extension.ts',
}, },

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
extension: './src/extension.ts', extension: './src/extension.ts',
}, },

View File

@@ -2,16 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
//@ts-check export default withBrowserDefaults({
context: import.meta.dirname,
'use strict';
const withBrowserDefaults
= require('../shared.webpack.config').browser;
module.exports = withBrowserDefaults({
context: __dirname,
entry: { entry: {
extension: './src/browser/emmetBrowserMain.ts' extension: './src/browser/emmetBrowserMain.ts'
}, },

View File

@@ -2,22 +2,18 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import path from 'path';
//@ts-check import withDefaults from '../shared.webpack.config.mjs';
'use strict'; export default withDefaults({
context: import.meta.dirname,
const path = require('path');
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
extension: './src/node/emmetNodeMain.ts', extension: './src/node/emmetNodeMain.ts',
}, },
output: { output: {
path: path.join(__dirname, 'dist', 'node'), path: path.join(import.meta.dirname, 'dist', 'node'),
filename: 'emmetNodeMain.js' filename: 'emmetNodeMain.js'
} }
}); });

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
//@ts-check export default withBrowserDefaults({
context: import.meta.dirname,
'use strict';
const withBrowserDefaults = require('../shared.webpack.config').browser;
module.exports = withBrowserDefaults({
context: __dirname,
entry: { entry: {
extension: './src/extensionEditingBrowserMain.ts' extension: './src/extensionEditingBrowserMain.ts'
}, },

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
extension: './src/extensionEditingMain.ts', extension: './src/extensionEditingMain.ts',
}, },

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
//@ts-check export default withBrowserDefaults({
context: import.meta.dirname,
'use strict';
const withBrowserDefaults = require('../shared.webpack.config').browser;
module.exports = withBrowserDefaults({
context: __dirname,
entry: { entry: {
extension: './src/extension.ts' extension: './src/extension.ts'
}, },

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
extension: './src/extension.ts' extension: './src/extension.ts'
}, },

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
main: './src/main.ts', main: './src/main.ts',
['askpass-main']: './src/askpass-main.ts', ['askpass-main']: './src/askpass-main.ts',

View File

@@ -2,27 +2,23 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import path from 'path';
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
//@ts-check export default withBrowserDefaults({
context: import.meta.dirname,
'use strict';
const path = require('path');
const withBrowserDefaults = require('../shared.webpack.config').browser;
module.exports = withBrowserDefaults({
context: __dirname,
node: false, node: false,
entry: { entry: {
extension: './src/extension.ts', extension: './src/extension.ts',
}, },
resolve: { resolve: {
alias: { alias: {
'uuid': path.resolve(__dirname, 'node_modules/uuid/dist/esm-browser/index.js'), 'uuid': path.resolve(import.meta.dirname, 'node_modules/uuid/dist/esm-browser/index.js'),
'./node/authServer': path.resolve(__dirname, 'src/browser/authServer'), './node/authServer': path.resolve(import.meta.dirname, 'src/browser/authServer'),
'./node/crypto': path.resolve(__dirname, 'src/browser/crypto'), './node/crypto': path.resolve(import.meta.dirname, 'src/browser/crypto'),
'./node/fetch': path.resolve(__dirname, 'src/browser/fetch'), './node/fetch': path.resolve(import.meta.dirname, 'src/browser/fetch'),
'./node/buffer': path.resolve(__dirname, 'src/browser/buffer'), './node/buffer': path.resolve(import.meta.dirname, 'src/browser/buffer'),
} }
} }
}); });

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
extension: './src/extension.ts', extension: './src/extension.ts',
}, },

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
extension: './src/extension.ts' extension: './src/extension.ts'
}, },

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
main: './src/main.ts', main: './src/main.ts',
}, },

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
main: './src/main.ts', main: './src/main.ts',
}, },

View File

@@ -2,21 +2,17 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
import path from 'path';
//@ts-check export default withBrowserDefaults({
context: path.join(import.meta.dirname, 'client'),
'use strict';
const withBrowserDefaults = require('../shared.webpack.config').browser;
const path = require('path');
module.exports = withBrowserDefaults({
context: path.join(__dirname, 'client'),
entry: { entry: {
extension: './src/browser/htmlClientMain.ts' extension: './src/browser/htmlClientMain.ts'
}, },
output: { output: {
filename: 'htmlClientMain.js', filename: 'htmlClientMain.js',
path: path.join(__dirname, 'client', 'dist', 'browser') path: path.join(import.meta.dirname, 'client', 'dist', 'browser')
} }
}); });

View File

@@ -2,21 +2,17 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
import path from 'path';
//@ts-check export default withDefaults({
context: path.join(import.meta.dirname, 'client'),
'use strict';
const withDefaults = require('../shared.webpack.config');
const path = require('path');
module.exports = withDefaults({
context: path.join(__dirname, 'client'),
entry: { entry: {
extension: './src/node/htmlClientMain.ts', extension: './src/node/htmlClientMain.ts',
}, },
output: { output: {
filename: 'htmlClientMain.js', filename: 'htmlClientMain.js',
path: path.join(__dirname, 'client', 'dist', 'node') path: path.join(import.meta.dirname, 'client', 'dist', 'node')
} }
}); });

View File

@@ -2,16 +2,12 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
//@ts-check import { browser as withBrowserDefaults } from '../../shared.webpack.config.mjs';
import path from 'path';
'use strict';
const withBrowserDefaults = require('../../shared.webpack.config').browser;
const path = require('path');
const serverConfig = withBrowserDefaults({ const serverConfig = withBrowserDefaults({
context: __dirname, context: import.meta.dirname,
entry: { entry: {
extension: './src/browser/htmlServerWorkerMain.ts', extension: './src/browser/htmlServerWorkerMain.ts',
}, },
@@ -23,7 +19,7 @@ const serverConfig = withBrowserDefaults({
}, },
output: { output: {
filename: 'htmlServerMain.js', filename: 'htmlServerMain.js',
path: path.join(__dirname, 'dist', 'browser'), path: path.join(import.meta.dirname, 'dist', 'browser'),
libraryTarget: 'var', libraryTarget: 'var',
library: 'serverExportVar' library: 'serverExportVar'
}, },
@@ -38,9 +34,9 @@ serverConfig.module.rules.push({
test: /javascriptLibs.ts$/, test: /javascriptLibs.ts$/,
use: [ use: [
{ {
loader: path.resolve(__dirname, 'build', 'javaScriptLibraryLoader.js') loader: path.resolve(import.meta.dirname, 'build', 'javaScriptLibraryLoader.js')
} }
] ]
}); });
module.exports = serverConfig; export default serverConfig;

View File

@@ -2,22 +2,18 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../../shared.webpack.config.mjs';
import path from 'path';
//@ts-check export default withDefaults({
context: path.join(import.meta.dirname),
'use strict';
const withDefaults = require('../../shared.webpack.config');
const path = require('path');
module.exports = withDefaults({
context: path.join(__dirname),
entry: { entry: {
extension: './src/node/htmlServerNodeMain.ts', extension: './src/node/htmlServerNodeMain.ts',
}, },
output: { output: {
filename: 'htmlServerMain.js', filename: 'htmlServerMain.js',
path: path.join(__dirname, 'dist', 'node'), path: path.join(import.meta.dirname, 'dist', 'node'),
}, },
externals: { externals: {
'typescript': 'commonjs typescript' 'typescript': 'commonjs typescript'

View File

@@ -2,37 +2,33 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
//@ts-check import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
import path from 'path';
'use strict';
const withBrowserDefaults = require('../shared.webpack.config').browser;
const path = require('path');
const mainConfig = withBrowserDefaults({ const mainConfig = withBrowserDefaults({
context: __dirname, context: import.meta.dirname,
entry: { entry: {
extension: './src/ipynbMain.browser.ts' extension: './src/ipynbMain.browser.ts'
}, },
output: { output: {
filename: 'ipynbMain.browser.js', filename: 'ipynbMain.browser.js',
path: path.join(__dirname, 'dist', 'browser') path: path.join(import.meta.dirname, 'dist', 'browser')
} }
}); });
const workerConfig = withBrowserDefaults({ const workerConfig = withBrowserDefaults({
context: __dirname, context: import.meta.dirname,
entry: { entry: {
notebookSerializerWorker: './src/notebookSerializerWorker.web.ts', notebookSerializerWorker: './src/notebookSerializerWorker.web.ts',
}, },
output: { output: {
filename: 'notebookSerializerWorker.js', filename: 'notebookSerializerWorker.js',
path: path.join(__dirname, 'dist', 'browser'), path: path.join(import.meta.dirname, 'dist', 'browser'),
libraryTarget: 'var', libraryTarget: 'var',
library: 'serverExportVar' library: 'serverExportVar'
}, },
}); });
module.exports = [mainConfig, workerConfig]; export default [mainConfig, workerConfig];

View File

@@ -2,25 +2,21 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults, { nodePlugins } from '../shared.webpack.config.mjs';
import path from 'path';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
const path = require('path');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
['ipynbMain.node']: './src/ipynbMain.node.ts', ['ipynbMain.node']: './src/ipynbMain.node.ts',
notebookSerializerWorker: './src/notebookSerializerWorker.ts', notebookSerializerWorker: './src/notebookSerializerWorker.ts',
}, },
output: { output: {
path: path.resolve(__dirname, 'dist'), path: path.resolve(import.meta.dirname, 'dist'),
filename: '[name].js' filename: '[name].js'
}, },
plugins: [ plugins: [
...withDefaults.nodePlugins(__dirname), // add plugins, don't replace inherited ...nodePlugins(import.meta.dirname), // add plugins, don't replace inherited
] ]
}); });

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
main: './src/main.ts', main: './src/main.ts',
}, },

View File

@@ -2,22 +2,18 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
import path from 'path';
//@ts-check export default withBrowserDefaults({
'use strict';
const withBrowserDefaults = require('../shared.webpack.config').browser;
const path = require('path');
module.exports = withBrowserDefaults({
target: 'webworker', target: 'webworker',
context: path.join(__dirname, 'client'), context: path.join(import.meta.dirname, 'client'),
entry: { entry: {
extension: './src/browser/jsonClientMain.ts' extension: './src/browser/jsonClientMain.ts'
}, },
output: { output: {
filename: 'jsonClientMain.js', filename: 'jsonClientMain.js',
path: path.join(__dirname, 'client', 'dist', 'browser') path: path.join(import.meta.dirname, 'client', 'dist', 'browser')
} }
}); });

View File

@@ -2,24 +2,20 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
//@ts-check import withDefaults from '../shared.webpack.config.mjs';
import path from 'path';
'use strict';
const withDefaults = require('../shared.webpack.config');
const path = require('path');
const config = withDefaults({ const config = withDefaults({
context: path.join(__dirname, 'client'), context: path.join(import.meta.dirname, 'client'),
entry: { entry: {
extension: './src/node/jsonClientMain.ts' extension: './src/node/jsonClientMain.ts'
}, },
output: { output: {
filename: 'jsonClientMain.js', filename: 'jsonClientMain.js',
path: path.join(__dirname, 'client', 'dist', 'node') path: path.join(import.meta.dirname, 'client', 'dist', 'node')
} }
}); });
module.exports = config; export default config;

View File

@@ -2,22 +2,18 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import { browser as withBrowserDefaults } from '../../shared.webpack.config.mjs';
import path from 'path';
//@ts-check export default withBrowserDefaults({
context: import.meta.dirname,
'use strict';
const withBrowserDefaults = require('../../shared.webpack.config').browser;
const path = require('path');
module.exports = withBrowserDefaults({
context: __dirname,
entry: { entry: {
extension: './src/browser/jsonServerWorkerMain.ts', extension: './src/browser/jsonServerWorkerMain.ts',
}, },
output: { output: {
filename: 'jsonServerMain.js', filename: 'jsonServerMain.js',
path: path.join(__dirname, 'dist', 'browser'), path: path.join(import.meta.dirname, 'dist', 'browser'),
libraryTarget: 'var', libraryTarget: 'var',
library: 'serverExportVar' library: 'serverExportVar'
} }

View File

@@ -2,23 +2,19 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
//@ts-check import withDefaults from '../../shared.webpack.config.mjs';
import path from 'path';
'use strict';
const withDefaults = require('../../shared.webpack.config');
const path = require('path');
const config = withDefaults({ const config = withDefaults({
context: path.join(__dirname), context: path.join(import.meta.dirname),
entry: { entry: {
extension: './src/node/jsonServerNodeMain.ts', extension: './src/node/jsonServerNodeMain.ts',
}, },
output: { output: {
filename: 'jsonServerMain.js', filename: 'jsonServerMain.js',
path: path.join(__dirname, 'dist', 'node'), path: path.join(import.meta.dirname, 'dist', 'node'),
} }
}); });
module.exports = config; export default config;

View File

@@ -2,21 +2,17 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import CopyPlugin from 'copy-webpack-plugin';
import { browser, browserPlugins } from '../shared.webpack.config.mjs';
//@ts-check export default browser({
context: import.meta.dirname,
'use strict';
const CopyPlugin = require('copy-webpack-plugin');
const { browserPlugins, browser } = require('../shared.webpack.config');
module.exports = browser({
context: __dirname,
entry: { entry: {
extension: './src/extension.browser.ts' extension: './src/extension.browser.ts'
}, },
plugins: [ plugins: [
...browserPlugins(__dirname), // add plugins, don't replace inherited ...browserPlugins(import.meta.dirname), // add plugins, don't replace inherited
new CopyPlugin({ new CopyPlugin({
patterns: [ patterns: [
{ {

View File

@@ -2,16 +2,12 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import CopyPlugin from 'copy-webpack-plugin';
import withDefaults, { nodePlugins } from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const CopyPlugin = require('copy-webpack-plugin');
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
resolve: { resolve: {
mainFields: ['module', 'main'] mainFields: ['module', 'main']
}, },
@@ -19,7 +15,7 @@ module.exports = withDefaults({
extension: './src/extension.ts', extension: './src/extension.ts',
}, },
plugins: [ plugins: [
...withDefaults.nodePlugins(__dirname), // add plugins, don't replace inherited ...nodePlugins(import.meta.dirname), // add plugins, don't replace inherited
new CopyPlugin({ new CopyPlugin({
patterns: [ patterns: [
{ {

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
//@ts-check export default withBrowserDefaults({
context: import.meta.dirname,
'use strict';
const withBrowserDefaults = require('../shared.webpack.config').browser;
module.exports = withBrowserDefaults({
context: __dirname,
entry: { entry: {
extension: './src/extension.ts' extension: './src/extension.ts'
} }

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
resolve: { resolve: {
mainFields: ['module', 'main'] mainFields: ['module', 'main']
}, },

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
//@ts-check export default withBrowserDefaults({
context: import.meta.dirname,
'use strict';
const withBrowserDefaults = require('../shared.webpack.config').browser;
module.exports = withBrowserDefaults({
context: __dirname,
entry: { entry: {
extension: './src/extension.ts' extension: './src/extension.ts'
}, },

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
resolve: { resolve: {
mainFields: ['module', 'main'] mainFields: ['module', 'main']
}, },

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
//@ts-check export default withBrowserDefaults({
context: import.meta.dirname,
'use strict';
const withBrowserDefaults = require('../shared.webpack.config').browser;
module.exports = withBrowserDefaults({
context: __dirname,
entry: { entry: {
extension: './src/mergeConflictMain.ts' extension: './src/mergeConflictMain.ts'
}, },

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
extension: './src/mergeConflictMain.ts' extension: './src/mergeConflictMain.ts'
}, },

View File

@@ -2,16 +2,12 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import path from 'path';
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
//@ts-check export default withBrowserDefaults({
context: import.meta.dirname,
'use strict';
const path = require('path');
const withBrowserDefaults = require('../shared.webpack.config').browser;
module.exports = withBrowserDefaults({
context: __dirname,
node: { node: {
global: true, global: true,
__filename: false, __filename: false,
@@ -22,10 +18,10 @@ module.exports = withBrowserDefaults({
}, },
resolve: { resolve: {
alias: { alias: {
'./node/authServer': path.resolve(__dirname, 'src/browser/authServer'), './node/authServer': path.resolve(import.meta.dirname, 'src/browser/authServer'),
'./node/buffer': path.resolve(__dirname, 'src/browser/buffer'), './node/buffer': path.resolve(import.meta.dirname, 'src/browser/buffer'),
'./node/fetch': path.resolve(__dirname, 'src/browser/fetch'), './node/fetch': path.resolve(import.meta.dirname, 'src/browser/fetch'),
'./node/authProvider': path.resolve(__dirname, 'src/browser/authProvider'), './node/authProvider': path.resolve(import.meta.dirname, 'src/browser/authProvider'),
} }
} }
}); });

View File

@@ -2,19 +2,15 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
//@ts-check import withDefaults, { nodePlugins } from '../shared.webpack.config.mjs';
import CopyWebpackPlugin from 'copy-webpack-plugin';
'use strict'; import path from 'path';
const withDefaults = require('../shared.webpack.config');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
const isWindows = process.platform === 'win32'; const isWindows = process.platform === 'win32';
module.exports = withDefaults({ export default withDefaults({
context: __dirname, context: import.meta.dirname,
entry: { entry: {
extension: './src/extension.ts' extension: './src/extension.ts'
}, },
@@ -26,11 +22,11 @@ module.exports = withDefaults({
}, },
resolve: { resolve: {
alias: { alias: {
'keytar': path.resolve(__dirname, 'packageMocks', 'keytar', 'index.js') 'keytar': path.resolve(import.meta.dirname, 'packageMocks', 'keytar', 'index.js')
} }
}, },
plugins: [ plugins: [
...withDefaults.nodePlugins(__dirname), ...nodePlugins(import.meta.dirname),
new CopyWebpackPlugin({ new CopyWebpackPlugin({
patterns: [ patterns: [
{ {

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
//@ts-check import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
'use strict';
const withBrowserDefaults = require('../shared.webpack.config').browser;
const config = withBrowserDefaults({ const config = withBrowserDefaults({
context: __dirname, context: import.meta.dirname,
entry: { entry: {
extension: './src/npmBrowserMain.ts' extension: './src/npmBrowserMain.ts'
}, },
@@ -24,4 +20,4 @@ const config = withBrowserDefaults({
} }
}); });
module.exports = config; export default config;

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
extension: './src/npmMain.ts', extension: './src/npmMain.ts',
}, },

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
extension: './src/phpMain.ts', extension: './src/phpMain.ts',
}, },

View File

@@ -2,21 +2,17 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
import path from 'path';
//@ts-check export default withBrowserDefaults({
context: import.meta.dirname,
'use strict';
const withBrowserDefaults = require('../shared.webpack.config').browser;
const path = require('path');
module.exports = withBrowserDefaults({
context: __dirname,
entry: { entry: {
extension: './src/extension.ts' extension: './src/extension.ts'
}, },
output: { output: {
filename: 'extension.js', filename: 'extension.js',
path: path.join(__dirname, 'dist') path: path.join(import.meta.dirname, 'dist')
} }
}); });

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
resolve: { resolve: {
mainFields: ['module', 'main'] mainFields: ['module', 'main']
}, },

View File

@@ -2,21 +2,17 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
import path from 'path';
//@ts-check export default withBrowserDefaults({
context: import.meta.dirname,
'use strict';
const withBrowserDefaults = require('../shared.webpack.config').browser;
const path = require('path');
module.exports = withBrowserDefaults({
context: __dirname,
entry: { entry: {
extension: './src/extension.ts' extension: './src/extension.ts'
}, },
output: { output: {
filename: 'extension.js', filename: 'extension.js',
path: path.join(__dirname, 'dist') path: path.join(import.meta.dirname, 'dist')
} }
}); });

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
resolve: { resolve: {
mainFields: ['module', 'main'] mainFields: ['module', 'main']
}, },

View File

@@ -2,17 +2,17 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import path from 'node:path';
import fs from 'node:fs';
import merge from 'merge-options';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import webpack from 'webpack';
import { createRequire } from 'node:module';
//@ts-check
/** @typedef {import('webpack').Configuration} WebpackConfig **/ /** @typedef {import('webpack').Configuration} WebpackConfig **/
'use strict'; const require = createRequire(import.meta.url);
const path = require('path');
const fs = require('fs');
const merge = require('merge-options');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const { DefinePlugin, optimize } = require('webpack');
const tsLoaderOptions = { const tsLoaderOptions = {
compilerOptions: { compilerOptions: {
@@ -48,7 +48,7 @@ function withNodeDefaults(/**@type WebpackConfig & { context: string }*/extConfi
loader: 'ts-loader', loader: 'ts-loader',
options: tsLoaderOptions options: tsLoaderOptions
}, { }, {
loader: path.resolve(__dirname, 'mangle-loader.js'), loader: path.resolve(import.meta.dirname, 'mangle-loader.js'),
options: { options: {
configFile: path.join(extConfig.context, 'tsconfig.json') configFile: path.join(extConfig.context, 'tsconfig.json')
}, },
@@ -85,8 +85,8 @@ function withNodeDefaults(/**@type WebpackConfig & { context: string }*/extConfi
*/ */
function nodePlugins(context) { function nodePlugins(context) {
// Need to find the top-most `package.json` file // Need to find the top-most `package.json` file
const folderName = path.relative(__dirname, context).split(/[\\\/]/)[0]; const folderName = path.relative(import.meta.dirname, context).split(/[\\\/]/)[0];
const pkgPath = path.join(__dirname, folderName, 'package.json'); const pkgPath = path.join(import.meta.dirname, folderName, 'package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
const id = `${pkg.publisher}.${pkg.name}`; const id = `${pkg.publisher}.${pkg.name}`;
return [ return [
@@ -136,7 +136,7 @@ function withBrowserDefaults(/**@type WebpackConfig & { context: string }*/extCo
} }
}, },
{ {
loader: path.resolve(__dirname, 'mangle-loader.js'), loader: path.resolve(import.meta.dirname, 'mangle-loader.js'),
options: { options: {
configFile: path.join(extConfig.context, additionalOptions?.configFile ?? 'tsconfig.json') configFile: path.join(extConfig.context, additionalOptions?.configFile ?? 'tsconfig.json')
}, },
@@ -184,7 +184,7 @@ function browserPlugins(context) {
// const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); // const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
// const id = `${pkg.publisher}.${pkg.name}`; // const id = `${pkg.publisher}.${pkg.name}`;
return [ return [
new optimize.LimitChunkCountPlugin({ new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1 maxChunks: 1
}), }),
new CopyWebpackPlugin({ new CopyWebpackPlugin({
@@ -192,7 +192,7 @@ function browserPlugins(context) {
{ from: 'src', to: '.', globOptions: { ignore: ['**/test/**', '**/*.ts'] }, noErrorOnMissing: true } { from: 'src', to: '.', globOptions: { ignore: ['**/test/**', '**/*.ts'] }, noErrorOnMissing: true }
] ]
}), }),
new DefinePlugin({ new webpack.DefinePlugin({
'process.platform': JSON.stringify('web'), 'process.platform': JSON.stringify('web'),
'process.env': JSON.stringify({}), 'process.env': JSON.stringify({}),
'process.env.BROWSER_ENV': JSON.stringify('true') 'process.env.BROWSER_ENV': JSON.stringify('true')
@@ -200,8 +200,5 @@ function browserPlugins(context) {
]; ];
} }
module.exports = withNodeDefaults; export default withNodeDefaults;
module.exports.node = withNodeDefaults; export { withNodeDefaults as node, withBrowserDefaults as browser, nodePlugins, browserPlugins };
module.exports.browser = withBrowserDefaults;
module.exports.nodePlugins = nodePlugins;
module.exports.browserPlugins = browserPlugins;

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
//@ts-check export default withBrowserDefaults({
context: import.meta.dirname,
'use strict';
const withBrowserDefaults = require('../shared.webpack.config').browser;
module.exports = withBrowserDefaults({
context: __dirname,
entry: { entry: {
extension: './src/extension.ts' extension: './src/extension.ts'
} }

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
resolve: { resolve: {
mainFields: ['module', 'main'] mainFields: ['module', 'main']
}, },

View File

@@ -2,14 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
'use strict'; context: import.meta.dirname,
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
extension: './src/terminalSuggestMain.ts' extension: './src/terminalSuggestMain.ts'
}, },

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: { entry: {
extension: './src/extension.ts', extension: './src/extension.ts',
}, },

View File

@@ -2,16 +2,10 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
//@ts-check import CopyPlugin from 'copy-webpack-plugin';
import path from 'path';
'use strict'; import defaultConfig, { browser as withBrowserDefaults, browserPlugins } from '../shared.webpack.config.mjs';
const CopyPlugin = require('copy-webpack-plugin');
const path = require('path');
const defaultConfig = require('../shared.webpack.config');
const withBrowserDefaults = defaultConfig.browser;
const browserPlugins = defaultConfig.browserPlugins;
const languages = [ const languages = [
'zh-tw', 'zh-tw',
@@ -28,13 +22,13 @@ const languages = [
'tr', 'tr',
'zh-cn', 'zh-cn',
]; ];
module.exports = [withBrowserDefaults({ export default [withBrowserDefaults({
context: __dirname, context: import.meta.dirname,
entry: { entry: {
extension: './src/extension.browser.ts', extension: './src/extension.browser.ts',
}, },
plugins: [ plugins: [
...browserPlugins(__dirname), // add plugins, don't replace inherited ...browserPlugins(import.meta.dirname), // add plugins, don't replace inherited
// @ts-ignore // @ts-ignore
new CopyPlugin({ new CopyPlugin({
@@ -63,7 +57,7 @@ module.exports = [withBrowserDefaults({
}), }),
], ],
}), withBrowserDefaults({ }), withBrowserDefaults({
context: __dirname, context: import.meta.dirname,
entry: { entry: {
'typescript/tsserver.web': './web/src/webServer.ts' 'typescript/tsserver.web': './web/src/webServer.ts'
}, },
@@ -75,7 +69,7 @@ module.exports = [withBrowserDefaults({
// all output goes into `dist`. // all output goes into `dist`.
// packaging depends on that and this must always be like it // packaging depends on that and this must always be like it
filename: '[name].js', filename: '[name].js',
path: path.join(__dirname, 'dist', 'browser'), path: path.join(import.meta.dirname, 'dist', 'browser'),
libraryTarget: undefined, libraryTarget: undefined,
}, },
externals: { externals: {

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
//@ts-check export default withDefaults({
context: import.meta.dirname,
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
resolve: { resolve: {
mainFields: ['module', 'main'] mainFields: ['module', 'main']
}, },

View File

@@ -2,15 +2,11 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// @ts-check
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
//@ts-check export default withBrowserDefaults({
context: import.meta.dirname,
'use strict';
const withBrowserDefaults = require('../shared.webpack.config').browser;
module.exports = withBrowserDefaults({
context: __dirname,
entry: { entry: {
extension: './src/extension.browser.ts' extension: './src/extension.browser.ts'
}, },