config loads without Node's MODULE_TYPELESS_PACKAGE_JSON warning in a CommonJS project; capture sign-in docs use captureAuth and check notes a local capture that signs in with reviewDemoAccount (the App Review account)
This commit is contained in:
parent
2fdd96e68c
commit
8c1a01d856
5 changed files with 38 additions and 5 deletions
|
|
@ -101,7 +101,10 @@ export async function importConfigModule(path: string): Promise<any> {
|
|||
async function withoutTypeStripWarning<T>(f: () => Promise<T>): Promise<T> {
|
||||
const emit = process.emitWarning;
|
||||
process.emitWarning = ((w: string | Error, ...rest: unknown[]) => {
|
||||
if (/Type Stripping|type stripping/i.test(String(typeof w === 'string' ? w : w.message))) return;
|
||||
// also Node's MODULE_TYPELESS_PACKAGE_JSON ("Reparsing as ES module") for a .ts config in a CommonJS package:
|
||||
// the config is ours to load, the app need not add "type": "module"
|
||||
const text = `${String(typeof w === 'string' ? w : w.message)} ${rest.map(r => (typeof r === 'object' && r ? JSON.stringify(r) : String(r))).join(' ')}`;
|
||||
if (/Type Stripping|type stripping|Reparsing as ES module|MODULE_TYPELESS_PACKAGE_JSON/i.test(text)) return;
|
||||
return (emit as (...a: unknown[]) => void).call(process, w, ...rest);
|
||||
}) as typeof process.emitWarning;
|
||||
try { return await f(); } finally { process.emitWarning = emit; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue