mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
f8de7b1273
This PR removes the manual vendoring process. Third party code can now be updated using the typical NPM pipeline with types/code bundling done through Rollup.
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
/**
|
|
* 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 path from 'path';
|
|
import dts from 'rollup-plugin-dts';
|
|
import resolve from 'rollup-plugin-node-resolve';
|
|
import glob from 'glob';
|
|
|
|
export default ['cjs', 'esm'].flatMap(outputType => {
|
|
const configs = [];
|
|
const vendorPath = path.resolve(__dirname, `lib/${outputType}/vendor`);
|
|
for (const jsFile of glob.sync(path.join(vendorPath, '**/*.js'))) {
|
|
configs.push({
|
|
input: jsFile,
|
|
output: {file: jsFile, exports: 'auto', format: outputType},
|
|
plugins: [resolve()],
|
|
});
|
|
}
|
|
for (const typesFile of glob.sync(path.join(vendorPath, '**/*.d.ts'))) {
|
|
configs.push({
|
|
input: typesFile,
|
|
output: {file: typesFile, format: outputType},
|
|
plugins: [dts({respectExternal: true})],
|
|
});
|
|
}
|
|
return configs;
|
|
});
|