PSF: Foundry Progress Sync. 57 high-fidelity blueprints established. Open Fleet routing (Kimi/Qwen) active. GTD updated.
This commit is contained in:
26
projects/org-skill-web-research/node_modules/playwright-extra/dist/helper/loader.d.ts
generated
vendored
Normal file
26
projects/org-skill-web-research/node_modules/playwright-extra/dist/helper/loader.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import type * as pw from 'playwright-core';
|
||||
/** Node.js module loader helper */
|
||||
export declare class Loader<TargetModule> {
|
||||
moduleName: string;
|
||||
packageNames: string[];
|
||||
constructor(moduleName: string, packageNames: string[]);
|
||||
/**
|
||||
* Lazy load a top level export from another module by wrapping it in a JS proxy.
|
||||
*
|
||||
* This allows us to re-export e.g. `devices` from `playwright` while redirecting direct calls
|
||||
* to it to the module version the user has installed, rather than shipping with a hardcoded version.
|
||||
*
|
||||
* If we don't do this and the user doesn't have the target module installed we'd throw immediately when our code is imported.
|
||||
*
|
||||
* We use a "super" Proxy defining all traps, so calls like `Object.keys(playwright.devices).length` will return the correct value.
|
||||
*/
|
||||
lazyloadExportOrDie<T extends keyof TargetModule>(exportName: T): TargetModule[T];
|
||||
/** Load the module if possible */
|
||||
loadModule(): TargetModule | undefined;
|
||||
/** Load the module if possible or throw */
|
||||
loadModuleOrDie(): TargetModule;
|
||||
get requireError(): Error;
|
||||
}
|
||||
export declare function requirePackages<TargetModule = any>(packageNames: string[]): TargetModule | undefined;
|
||||
/** Playwright specific module loader */
|
||||
export declare const playwrightLoader: Loader<typeof pw>;
|
||||
80
projects/org-skill-web-research/node_modules/playwright-extra/dist/helper/loader.js
generated
vendored
Normal file
80
projects/org-skill-web-research/node_modules/playwright-extra/dist/helper/loader.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.playwrightLoader = exports.requirePackages = exports.Loader = void 0;
|
||||
/** Node.js module loader helper */
|
||||
class Loader {
|
||||
constructor(moduleName, packageNames) {
|
||||
this.moduleName = moduleName;
|
||||
this.packageNames = packageNames;
|
||||
}
|
||||
/**
|
||||
* Lazy load a top level export from another module by wrapping it in a JS proxy.
|
||||
*
|
||||
* This allows us to re-export e.g. `devices` from `playwright` while redirecting direct calls
|
||||
* to it to the module version the user has installed, rather than shipping with a hardcoded version.
|
||||
*
|
||||
* If we don't do this and the user doesn't have the target module installed we'd throw immediately when our code is imported.
|
||||
*
|
||||
* We use a "super" Proxy defining all traps, so calls like `Object.keys(playwright.devices).length` will return the correct value.
|
||||
*/
|
||||
lazyloadExportOrDie(exportName) {
|
||||
const that = this;
|
||||
const trapHandler = Object.fromEntries(Object.getOwnPropertyNames(Reflect).map((name) => [
|
||||
name,
|
||||
function (target, ...args) {
|
||||
const moduleExport = that.loadModuleOrDie()[exportName];
|
||||
const customTarget = moduleExport;
|
||||
const result = Reflect[name](customTarget || target, ...args);
|
||||
return result;
|
||||
}
|
||||
]));
|
||||
return new Proxy({}, trapHandler);
|
||||
}
|
||||
/** Load the module if possible */
|
||||
loadModule() {
|
||||
return requirePackages(this.packageNames);
|
||||
}
|
||||
/** Load the module if possible or throw */
|
||||
loadModuleOrDie() {
|
||||
const module = requirePackages(this.packageNames);
|
||||
if (module) {
|
||||
return module;
|
||||
}
|
||||
throw this.requireError;
|
||||
}
|
||||
get requireError() {
|
||||
const moduleNamePretty = this.moduleName.charAt(0).toUpperCase() + this.moduleName.slice(1);
|
||||
return new Error(`
|
||||
${moduleNamePretty} is missing. :-)
|
||||
|
||||
I've tried loading ${this.packageNames
|
||||
.map(p => `"${p}"`)
|
||||
.join(', ')} - no luck.
|
||||
|
||||
Make sure you install one of those packages or use the named 'addExtra' export,
|
||||
to patch a specific (and maybe non-standard) implementation of ${moduleNamePretty}.
|
||||
|
||||
To get the latest stable version of ${moduleNamePretty} run:
|
||||
'yarn add ${this.moduleName}' or 'npm i ${this.moduleName}'
|
||||
`);
|
||||
}
|
||||
}
|
||||
exports.Loader = Loader;
|
||||
function requirePackages(packageNames) {
|
||||
for (const name of packageNames) {
|
||||
try {
|
||||
return require(name);
|
||||
}
|
||||
catch (_) {
|
||||
continue; // noop
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
exports.requirePackages = requirePackages;
|
||||
/** Playwright specific module loader */
|
||||
exports.playwrightLoader = new Loader('playwright', [
|
||||
'playwright-core',
|
||||
'playwright'
|
||||
]);
|
||||
//# sourceMappingURL=loader.js.map
|
||||
1
projects/org-skill-web-research/node_modules/playwright-extra/dist/helper/loader.js.map
generated
vendored
Normal file
1
projects/org-skill-web-research/node_modules/playwright-extra/dist/helper/loader.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/helper/loader.ts"],"names":[],"mappings":";;;AAEA,mCAAmC;AACnC,MAAa,MAAM;IACjB,YAAmB,UAAkB,EAAS,YAAsB;QAAjD,eAAU,GAAV,UAAU,CAAQ;QAAS,iBAAY,GAAZ,YAAY,CAAU;IAAG,CAAC;IAExE;;;;;;;;;OASG;IACI,mBAAmB,CAA+B,UAAa;QACpE,MAAM,IAAI,GAAG,IAAI,CAAA;QACjB,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CACpC,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC;YACrD,IAAI;YACJ,UAAU,MAAW,EAAE,GAAG,IAAW;gBACnC,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC,UAAU,CAAC,CAAA;gBACvD,MAAM,YAAY,GAAG,YAAmB,CAAA;gBACxC,MAAM,MAAM,GAAK,OAAe,CAAC,IAAI,CAAS,CAC5C,YAAY,IAAI,MAAM,EACtB,GAAG,IAAI,CACR,CAAA;gBACD,OAAO,MAAM,CAAA;YACf,CAAC;SACF,CAAC,CACH,CAAA;QACD,OAAO,IAAI,KAAK,CAAC,EAAE,EAAE,WAAW,CAAoB,CAAA;IACtD,CAAC;IAED,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