chore: remove rollup (#11135)
This commit is contained in:
parent
7a38586d9d
commit
4170fefc5c
@ -120,9 +120,6 @@
|
||||
"@microsoft/api-extractor-model": "7.28.2",
|
||||
"@pptr/testserver": "file:packages/testserver",
|
||||
"@prettier/sync": "0.3.0",
|
||||
"@rollup/plugin-commonjs": "25.0.5",
|
||||
"@rollup/plugin-node-resolve": "15.2.3",
|
||||
"@rollup/plugin-terser": "0.4.4",
|
||||
"@types/debug": "4.1.9",
|
||||
"@types/diff": "5.0.5",
|
||||
"@types/mime": "3.0.2",
|
||||
@ -169,7 +166,6 @@
|
||||
"pngjs": "7.0.0",
|
||||
"prettier": "3.0.3",
|
||||
"puppeteer": "file:packages/puppeteer",
|
||||
"rollup": "4.0.2",
|
||||
"semver": "7.5.4",
|
||||
"sinon": "16.1.0",
|
||||
"source-map-support": "0.5.21",
|
||||
|
@ -38,8 +38,7 @@ export const generateInjectedTask = task({
|
||||
entryPoints: ['src/injected/injected.ts'],
|
||||
bundle: true,
|
||||
format: 'cjs',
|
||||
platform: 'browser',
|
||||
target: 'ES2022',
|
||||
target: 'chrome117',
|
||||
minify: true,
|
||||
write: false,
|
||||
});
|
||||
@ -52,9 +51,21 @@ export const generateInjectedTask = task({
|
||||
},
|
||||
});
|
||||
|
||||
export const generatePackageJsonTask = task({
|
||||
name: 'generate:package-json',
|
||||
run: async () => {
|
||||
await mkdir('lib/esm', {recursive: true});
|
||||
await writeFile('lib/esm/package.json', JSON.stringify({type: 'module'}));
|
||||
},
|
||||
});
|
||||
|
||||
export const generateTask = task({
|
||||
name: 'generate',
|
||||
dependencies: [generateVersionTask, generateInjectedTask],
|
||||
dependencies: [
|
||||
generateVersionTask,
|
||||
generateInjectedTask,
|
||||
generatePackageJsonTask,
|
||||
],
|
||||
});
|
||||
|
||||
export const buildTscTask = task({
|
||||
@ -62,7 +73,32 @@ export const buildTscTask = task({
|
||||
dependencies: [generateTask],
|
||||
run: async () => {
|
||||
await execa('tsc', ['-b']);
|
||||
await execa('rollup', ['-c', 'rollup.third_party.config.mjs']);
|
||||
await writeFile('lib/esm/package.json', JSON.stringify({type: 'module'}));
|
||||
},
|
||||
});
|
||||
|
||||
export const buildTask = task({
|
||||
name: 'build',
|
||||
dependencies: [buildTscTask],
|
||||
run: async () => {
|
||||
const packages = ['mitt', 'rxjs'];
|
||||
const formats = ['esm', 'cjs'];
|
||||
const builders = [];
|
||||
for (const name of packages) {
|
||||
for (const format of formats) {
|
||||
const filePath = `lib/${format}/third_party/${name}/${name}.js`;
|
||||
builders.push(
|
||||
await esbuild.build({
|
||||
entryPoints: [filePath],
|
||||
outfile: filePath,
|
||||
bundle: true,
|
||||
allowOverwrite: true,
|
||||
format,
|
||||
target: 'node16',
|
||||
minify: true,
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
await Promise.all(builders);
|
||||
},
|
||||
});
|
||||
|
@ -69,13 +69,12 @@
|
||||
]
|
||||
},
|
||||
"build:tsc": {
|
||||
"command": "hereby build:tsc",
|
||||
"command": "hereby build",
|
||||
"clean": "if-file-deleted",
|
||||
"dependencies": [
|
||||
"../browsers:build"
|
||||
],
|
||||
"files": [
|
||||
"rollup.third_party.config.mjs",
|
||||
"{src,third_party}/**",
|
||||
"../../versions.js",
|
||||
"!src/generated"
|
||||
|
@ -1,51 +0,0 @@
|
||||
/**
|
||||
* Copyright 2022 Google Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
import {nodeResolve} from '@rollup/plugin-node-resolve';
|
||||
import terser from '@rollup/plugin-terser';
|
||||
import {globSync} from 'glob';
|
||||
|
||||
/**
|
||||
* @type {import('rollup').InputOptions[]}
|
||||
*/
|
||||
const configs = [];
|
||||
|
||||
// Note we don't use path.join here. We cannot since `glob` does not support
|
||||
// the backslash path separator.
|
||||
for (const file of globSync(`lib/esm/third_party/**/*.js`)) {
|
||||
configs.push({
|
||||
input: file,
|
||||
output: [
|
||||
{
|
||||
file,
|
||||
format: 'esm',
|
||||
},
|
||||
{
|
||||
file: file.replace('/esm/', '/cjs/'),
|
||||
format: 'cjs',
|
||||
},
|
||||
],
|
||||
plugins: [
|
||||
terser(),
|
||||
nodeResolve(),
|
||||
commonjs({
|
||||
transformMixedEsModules: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
export default configs;
|
Loading…
Reference in New Issue
Block a user