esm - set `type: module` top level (#230210)
parent
990b1fdb91
commit
f09184ceb7
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"type": "commonjs"
|
||||||
|
}
|
|
@ -5,9 +5,15 @@
|
||||||
|
|
||||||
//@ts-check
|
//@ts-check
|
||||||
|
|
||||||
const path = require('path');
|
import { createRequire } from 'node:module';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as os from 'os';
|
||||||
|
|
||||||
|
const require = createRequire(import.meta.url);
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
const { defineConfig } = require('@vscode/test-cli');
|
const { defineConfig } = require('@vscode/test-cli');
|
||||||
const os = require('os');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of extension folders who have opted into tests, or configuration objects.
|
* A list of extension folders who have opted into tests, or configuration objects.
|
||||||
|
@ -57,7 +63,7 @@ const defaultLaunchArgs = process.env.API_TESTS_EXTRA_ARGS?.split(' ') || [
|
||||||
'--disable-telemetry', '--skip-welcome', '--skip-release-notes', `--crash-reporter-directory=${__dirname}/.build/crashes`, `--logsPath=${__dirname}/.build/logs/integration-tests`, '--no-cached-data', '--disable-updates', '--use-inmemory-secretstorage', '--disable-extensions', '--disable-workspace-trust'
|
'--disable-telemetry', '--skip-welcome', '--skip-release-notes', `--crash-reporter-directory=${__dirname}/.build/crashes`, `--logsPath=${__dirname}/.build/logs/integration-tests`, '--no-cached-data', '--disable-updates', '--use-inmemory-secretstorage', '--disable-extensions', '--disable-workspace-trust'
|
||||||
];
|
];
|
||||||
|
|
||||||
module.exports = defineConfig(extensions.map(extension => {
|
const config = defineConfig(extensions.map(extension => {
|
||||||
/** @type {import('@vscode/test-cli').TestConfiguration} */
|
/** @type {import('@vscode/test-cli').TestConfiguration} */
|
||||||
const config = typeof extension === 'object'
|
const config = typeof extension === 'object'
|
||||||
? { files: `extensions/${extension.label}/out/**/*.test.js`, ...extension }
|
? { files: `extensions/${extension.label}/out/**/*.test.js`, ...extension }
|
||||||
|
@ -99,3 +105,5 @@ module.exports = defineConfig(extensions.map(extension => {
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
export default config;
|
||||||
|
|
|
@ -308,7 +308,7 @@ function packageTask(type, platform, arch, sourceFolderName, destinationFolderNa
|
||||||
|
|
||||||
let packageJsonContents;
|
let packageJsonContents;
|
||||||
const packageJsonStream = gulp.src(['remote/package.json'], { base: 'remote' })
|
const packageJsonStream = gulp.src(['remote/package.json'], { base: 'remote' })
|
||||||
.pipe(json({ name, version, dependencies: undefined, optionalDependencies: undefined, ...{ type: 'module' } })) // TODO@esm this should be configured in the top level package.json
|
.pipe(json({ name, version, dependencies: undefined, optionalDependencies: undefined, type: 'module' }))
|
||||||
.pipe(es.through(function (file) {
|
.pipe(es.through(function (file) {
|
||||||
packageJsonContents = file.contents.toString();
|
packageJsonContents = file.contents.toString();
|
||||||
this.emit('data', file);
|
this.emit('data', file);
|
||||||
|
|
|
@ -269,7 +269,7 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
|
||||||
}
|
}
|
||||||
|
|
||||||
const name = product.nameShort;
|
const name = product.nameShort;
|
||||||
const packageJsonUpdates = { name, version, ...{ type: 'module', main: 'out/main.js' } }; // TODO@esm this should be configured in the top level package.json
|
const packageJsonUpdates = { name, version };
|
||||||
|
|
||||||
// for linux url handling
|
// for linux url handling
|
||||||
if (platform === 'linux') {
|
if (platform === 'linux') {
|
||||||
|
|
|
@ -3,4 +3,7 @@
|
||||||
* 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.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import { createRequire } from 'node:module';
|
||||||
|
|
||||||
|
const require = createRequire(import.meta.url);
|
||||||
require('./build/gulpfile');
|
require('./build/gulpfile');
|
||||||
|
|
|
@ -6,13 +6,14 @@
|
||||||
"name": "Microsoft Corporation"
|
"name": "Microsoft Corporation"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./out/main",
|
"main": "./out/main.js",
|
||||||
|
"type": "module",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo Please run any of the test scripts from the scripts folder.",
|
"test": "echo Please run any of the test scripts from the scripts folder.",
|
||||||
"test-browser": "npx playwright install && node test/unit/browser/index.js",
|
"test-browser": "npx playwright install && node test/unit/browser/index.js",
|
||||||
"test-browser-no-install": "node test/unit/browser/index.js",
|
"test-browser-no-install": "node test/unit/browser/index.js",
|
||||||
"test-node": "mocha test/unit/node/index.mjs --delay --ui=tdd --timeout=5000 --exit",
|
"test-node": "mocha test/unit/node/index.js --delay --ui=tdd --timeout=5000 --exit",
|
||||||
"test-extension": "vscode-test",
|
"test-extension": "vscode-test",
|
||||||
"preinstall": "node build/npm/preinstall.js",
|
"preinstall": "node build/npm/preinstall.js",
|
||||||
"postinstall": "node build/npm/postinstall.js",
|
"postinstall": "node build/npm/postinstall.js",
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"type": "commonjs"
|
||||||
|
}
|
|
@ -14,9 +14,7 @@ import * as path from 'path';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import glob from 'glob';
|
import glob from 'glob';
|
||||||
import minimatch from 'minimatch';
|
import minimatch from 'minimatch';
|
||||||
// const coverage = require('../coverage');
|
|
||||||
import minimist from 'minimist';
|
import minimist from 'minimist';
|
||||||
// const { takeSnapshotAndCountClasses } = require('../analyzeSnapshot');
|
|
||||||
import * as module from 'module';
|
import * as module from 'module';
|
||||||
import { fileURLToPath, pathToFileURL } from 'url';
|
import { fileURLToPath, pathToFileURL } from 'url';
|
||||||
|
|
Loading…
Reference in New Issue