代码拉取完成,页面将自动刷新
同步操作将从 feng3d/feng3d 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import path from 'path';
import transpile from 'rollup-plugin-buble';
import json from 'rollup-plugin-json';
import resolve from 'rollup-plugin-node-resolve';
import { string } from 'rollup-plugin-string';
import sourcemaps from 'rollup-plugin-sourcemaps';
import typescript from 'rollup-plugin-typescript';
import dts from 'rollup-plugin-dts';
import minimist from 'minimist';
import commonjs from 'rollup-plugin-commonjs';
import replace from 'rollup-plugin-replace';
import { terser } from 'rollup-plugin-terser';
import batchPackages from '@lerna/batch-packages';
import filterPackages from '@lerna/filter-packages';
import { getPackages } from '@lerna/project';
import repo from './lerna.json';
import fs from 'fs';
/**
* Get a list of the non-private sorted packages with Lerna v3
* @see https://github.com/lerna/lerna/issues/1848
* @return {Promise<Package[]>} List of packages
*/
async function getSortedPackages(scope, ignore)
{
const packages = await getPackages(__dirname);
const filtered = filterPackages(
packages,
scope,
ignore,
false
);
return batchPackages(filtered)
.reduce((arr, batch) => arr.concat(batch), []);
}
async function main()
{
const plugins = [
sourcemaps(),
json(),
resolve({
browser: true,
preferBuiltins: false,
}),
commonjs({}),
typescript(),
string({
include: [
'**/*.frag',
'**/*.vert',
],
}),
replace({
__VERSION__: repo.version,
}),
transpile(),
];
const compiled = (new Date()).toUTCString().replace(/GMT/g, 'UTC');
const sourcemap = true;
const results = [];
// Support --scope and --ignore globs if passed in via commandline
const { scope, ignore } = minimist(process.argv.slice(2));
const packages = await getSortedPackages(scope, ignore);
const namespaces = {};
const pkgData = {};
// Create a map of globals to use for bundled packages
packages.forEach((pkg) =>
{
const data = pkg.toJSON();
pkgData[pkg.name] = data;
namespaces[pkg.name] = data.namespace || 'feng3d';
});
packages.forEach((pkg) =>
{
let banner = [
`/*!`,
` * ${pkg.name} - v${pkg.version}`,
` * Compiled ${compiled}`,
` *`,
` * ${pkg.name} is licensed under the MIT License.`,
` * http://www.opensource.org/licenses/mit-license`,
` */`,
].join('\n');
// Check for bundle folder
const external = Object.keys(pkg.dependencies || []);
const basePath = path.relative(__dirname, pkg.location);
const input = path.join(basePath, 'src/index.ts');
const {
main,
module,
bundle,
bundleInput,
bundleOutput,
bundleNoExports,
standalone,
types,
} = pkgData[pkg.name];
const freeze = false;
results.push({
input,
output: [
{
banner,
file: path.join(basePath, main),
format: 'cjs',
freeze,
sourcemap,
},
{
banner,
file: path.join(basePath, module),
format: 'esm',
freeze,
sourcemap,
},
],
external,
plugins,
});
results.push({
input,
external: standalone ? [] : external,
output: [{ file: path.join(basePath, types), format: 'es' }],
plugins: [
json(),
typescript(),
dts(),
],
});
// The package.json file has a bundle field
// we'll use this to generate the bundle file
// this will package all dependencies
if (bundle)
{
let input = path.join(basePath, bundleInput || 'src/index.ts');
// TODO: remove check once all packages have been converted to typescript
if (!fs.existsSync(input))
{
input = path.join(basePath, bundleInput || 'src/index.js');
}
const file = path.join(basePath, bundle);
const external = standalone ? null : Object.keys(namespaces);
const globals = standalone ? null : namespaces;
const ns = namespaces[pkg.name];
const name = pkg.name.replace(/[^a-z0-9]+/g, '_');
let footer;
if (!standalone)
{
if (bundleNoExports !== true)
{
footer = `Object.assign(this.${ns}, ${name});`;
}
if (ns.includes('.'))
{
const base = ns.split('.')[0];
banner += `\nthis.${base} = this.${base} || {};`;
}
banner += `\nthis.${ns} = this.${ns} || {};`;
}
results.push({
input,
external,
output: Object.assign({
banner,
file,
format: 'iife',
freeze,
globals,
name,
footer,
sourcemap,
}, bundleOutput),
treeshake: false,
plugins,
});
if (process.env.NODE_ENV === 'production')
{
results.push({
input,
external,
output: Object.assign({
banner,
file: file.replace(/\.js$/, '.min.js'),
format: 'iife',
freeze,
globals,
name,
footer,
sourcemap,
}, bundleOutput),
treeshake: false,
plugins: [...plugins, terser({
output: {
comments: (node, comment) => comment.line === 1,
},
})],
});
}
}
});
return results;
}
export default main();
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。