fix(core): update
This commit is contained in:
parent
ae16fd8170
commit
a3ab55cbc6
@ -9,7 +9,8 @@ tap.test('should bundle test', async () => {
|
||||
process.cwd() + '/test',
|
||||
'./ts_web/index.ts',
|
||||
'./dist_manual/test.js',
|
||||
'rollup'
|
||||
'rollup',
|
||||
{}
|
||||
);
|
||||
});
|
||||
|
||||
@ -18,7 +19,9 @@ tap.test('should bundle production', async () => {
|
||||
await tsbundleInstance.buildProduction(
|
||||
process.cwd(),
|
||||
'./test/ts_web/index.ts',
|
||||
'./test/dist_manual/production.js'
|
||||
'./test/dist_manual/production.js',
|
||||
'rollup',
|
||||
{}
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -11,7 +11,10 @@ export class TsBundle {
|
||||
) {
|
||||
const done = plugins.smartpromise.defer();
|
||||
const threadsimple = new plugins.smartspawn.ThreadSimple(
|
||||
plugins.path.join(plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), './tsbundle.class.tsbundleprocess.js'),
|
||||
plugins.path.join(
|
||||
plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
|
||||
'./tsbundle.class.tsbundleprocess.js'
|
||||
),
|
||||
[],
|
||||
{
|
||||
env: {
|
||||
@ -21,7 +24,7 @@ export class TsBundle {
|
||||
tsbundleFrom: fromArg,
|
||||
tsbundleTo: toArg,
|
||||
tsbundleBundler: bundlerArg,
|
||||
tsbundleArgv: argvArg,
|
||||
tsbundleArgv: argvArg ? JSON.stringify(argvArg) : '{}',
|
||||
},
|
||||
}
|
||||
);
|
||||
@ -41,7 +44,10 @@ export class TsBundle {
|
||||
) {
|
||||
const done = plugins.smartpromise.defer();
|
||||
const threadsimple = new plugins.smartspawn.ThreadSimple(
|
||||
plugins.path.join(plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), './tsbundle.class.tsbundleprocess.js'),
|
||||
plugins.path.join(
|
||||
plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
|
||||
'./tsbundle.class.tsbundleprocess.js'
|
||||
),
|
||||
[],
|
||||
{
|
||||
env: {
|
||||
@ -51,7 +57,7 @@ export class TsBundle {
|
||||
tsbundleFrom: fromArg,
|
||||
tsbundleTo: toArg,
|
||||
tsbundleBundler: bundlerArg,
|
||||
tsbundleArgv: argvArg,
|
||||
tsbundleArgv: argvArg ? JSON.stringify(argvArg) : '{}',
|
||||
},
|
||||
}
|
||||
);
|
||||
|
@ -44,16 +44,22 @@ export class TsBundleProcess {
|
||||
moduleResolution: 'node12',
|
||||
allowSyntheticDefaultImports: true,
|
||||
importsNotUsedAsValues: 'preserve',
|
||||
...argvArg && argvArg.skiplibcheck ? {
|
||||
skipLibCheck: true
|
||||
} : {},
|
||||
...argvArg && argvArg.allowimplicitany ? {
|
||||
noImplicitAny: false
|
||||
} : {},
|
||||
...argvArg && argvArg.commonjs ? {
|
||||
...(argvArg && argvArg.skiplibcheck
|
||||
? {
|
||||
skipLibCheck: true,
|
||||
}
|
||||
: {}),
|
||||
...(argvArg && argvArg.allowimplicitany
|
||||
? {
|
||||
noImplicitAny: false,
|
||||
}
|
||||
: {}),
|
||||
...(argvArg && argvArg.commonjs
|
||||
? {
|
||||
module: 'commonjs',
|
||||
moduleResolution: 'node',
|
||||
} : {},
|
||||
}
|
||||
: {}),
|
||||
}),
|
||||
(plugins.rollupJson as any)(),
|
||||
// Allow node_modules resolution, so you can use 'external' to control
|
||||
@ -69,11 +75,19 @@ export class TsBundleProcess {
|
||||
return baseOptions;
|
||||
}
|
||||
|
||||
public getOptionsTest(fromArg: string, toArg: string, argvArg: any): plugins.rollup.RollupOptions {
|
||||
public getOptionsTest(
|
||||
fromArg: string,
|
||||
toArg: string,
|
||||
argvArg: any
|
||||
): plugins.rollup.RollupOptions {
|
||||
return this.getBaseOptions(fromArg, toArg, argvArg);
|
||||
}
|
||||
|
||||
public getOptionsProduction(fromArg: string, toArg: string, argvArg: any): plugins.rollup.RollupOptions {
|
||||
public getOptionsProduction(
|
||||
fromArg: string,
|
||||
toArg: string,
|
||||
argvArg: any
|
||||
): plugins.rollup.RollupOptions {
|
||||
const productionOptions = this.getBaseOptions(fromArg, toArg, argvArg);
|
||||
productionOptions.plugins.push(
|
||||
plugins.rollupTerser({
|
||||
@ -147,10 +161,14 @@ const run = async () => {
|
||||
process.env.tsbundleFrom,
|
||||
process.env.tsbundleTo,
|
||||
process.env.tsbundleBundler as 'rollup' | 'parcel',
|
||||
process.env.tsbundleArgv
|
||||
JSON.parse(process.env.tsbundleArgv)
|
||||
);
|
||||
} else {
|
||||
tsbundleProcessInstance.buildProduction(process.env.tsbundleFrom, process.env.tsbundleTo, process.env.tsbundleArgv);
|
||||
tsbundleProcessInstance.buildProduction(
|
||||
process.env.tsbundleFrom,
|
||||
process.env.tsbundleTo,
|
||||
JSON.parse(process.env.tsbundleArgv)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user