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',
|
process.cwd() + '/test',
|
||||||
'./ts_web/index.ts',
|
'./ts_web/index.ts',
|
||||||
'./dist_manual/test.js',
|
'./dist_manual/test.js',
|
||||||
'rollup'
|
'rollup',
|
||||||
|
{}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -18,7 +19,9 @@ tap.test('should bundle production', async () => {
|
|||||||
await tsbundleInstance.buildProduction(
|
await tsbundleInstance.buildProduction(
|
||||||
process.cwd(),
|
process.cwd(),
|
||||||
'./test/ts_web/index.ts',
|
'./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 done = plugins.smartpromise.defer();
|
||||||
const threadsimple = new plugins.smartspawn.ThreadSimple(
|
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: {
|
env: {
|
||||||
@ -21,7 +24,7 @@ export class TsBundle {
|
|||||||
tsbundleFrom: fromArg,
|
tsbundleFrom: fromArg,
|
||||||
tsbundleTo: toArg,
|
tsbundleTo: toArg,
|
||||||
tsbundleBundler: bundlerArg,
|
tsbundleBundler: bundlerArg,
|
||||||
tsbundleArgv: argvArg,
|
tsbundleArgv: argvArg ? JSON.stringify(argvArg) : '{}',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -41,7 +44,10 @@ export class TsBundle {
|
|||||||
) {
|
) {
|
||||||
const done = plugins.smartpromise.defer();
|
const done = plugins.smartpromise.defer();
|
||||||
const threadsimple = new plugins.smartspawn.ThreadSimple(
|
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: {
|
env: {
|
||||||
@ -51,7 +57,7 @@ export class TsBundle {
|
|||||||
tsbundleFrom: fromArg,
|
tsbundleFrom: fromArg,
|
||||||
tsbundleTo: toArg,
|
tsbundleTo: toArg,
|
||||||
tsbundleBundler: bundlerArg,
|
tsbundleBundler: bundlerArg,
|
||||||
tsbundleArgv: argvArg,
|
tsbundleArgv: argvArg ? JSON.stringify(argvArg) : '{}',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -44,16 +44,22 @@ export class TsBundleProcess {
|
|||||||
moduleResolution: 'node12',
|
moduleResolution: 'node12',
|
||||||
allowSyntheticDefaultImports: true,
|
allowSyntheticDefaultImports: true,
|
||||||
importsNotUsedAsValues: 'preserve',
|
importsNotUsedAsValues: 'preserve',
|
||||||
...argvArg && argvArg.skiplibcheck ? {
|
...(argvArg && argvArg.skiplibcheck
|
||||||
skipLibCheck: true
|
? {
|
||||||
} : {},
|
skipLibCheck: true,
|
||||||
...argvArg && argvArg.allowimplicitany ? {
|
}
|
||||||
noImplicitAny: false
|
: {}),
|
||||||
} : {},
|
...(argvArg && argvArg.allowimplicitany
|
||||||
...argvArg && argvArg.commonjs ? {
|
? {
|
||||||
|
noImplicitAny: false,
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
...(argvArg && argvArg.commonjs
|
||||||
|
? {
|
||||||
module: 'commonjs',
|
module: 'commonjs',
|
||||||
moduleResolution: 'node',
|
moduleResolution: 'node',
|
||||||
} : {},
|
}
|
||||||
|
: {}),
|
||||||
}),
|
}),
|
||||||
(plugins.rollupJson as any)(),
|
(plugins.rollupJson as any)(),
|
||||||
// Allow node_modules resolution, so you can use 'external' to control
|
// Allow node_modules resolution, so you can use 'external' to control
|
||||||
@ -69,11 +75,19 @@ export class TsBundleProcess {
|
|||||||
return baseOptions;
|
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);
|
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);
|
const productionOptions = this.getBaseOptions(fromArg, toArg, argvArg);
|
||||||
productionOptions.plugins.push(
|
productionOptions.plugins.push(
|
||||||
plugins.rollupTerser({
|
plugins.rollupTerser({
|
||||||
@ -147,10 +161,14 @@ const run = async () => {
|
|||||||
process.env.tsbundleFrom,
|
process.env.tsbundleFrom,
|
||||||
process.env.tsbundleTo,
|
process.env.tsbundleTo,
|
||||||
process.env.tsbundleBundler as 'rollup' | 'parcel',
|
process.env.tsbundleBundler as 'rollup' | 'parcel',
|
||||||
process.env.tsbundleArgv
|
JSON.parse(process.env.tsbundleArgv)
|
||||||
);
|
);
|
||||||
} else {
|
} 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