Fixed the SPA authentication flow
This commit is contained in:
@@ -8,6 +8,7 @@ const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..")
|
||||
const distDir = path.join(rootDir, "dist");
|
||||
const contentScript = composition.composeScript("content");
|
||||
const backgroundScript = composition.composeScript("background");
|
||||
const spaPageScript = composition.composeScript("spa-page");
|
||||
const checkOnly = process.argv.includes("--check");
|
||||
|
||||
const baseManifest = {
|
||||
@@ -35,6 +36,12 @@ const baseManifest = {
|
||||
js: ["content.js"],
|
||||
all_frames: true,
|
||||
run_at: "document_idle"
|
||||
},
|
||||
{
|
||||
matches: ["https://spa.oracle.com/*"],
|
||||
js: ["spa-page.js"],
|
||||
all_frames: false,
|
||||
run_at: "document_idle"
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -70,7 +77,7 @@ for (const target of targets) {
|
||||
JSON.parse(manifestJson);
|
||||
|
||||
if (checkOnly) {
|
||||
const expected = { "manifest.json": manifestJson, "content.js": contentScript, "background.js": backgroundScript };
|
||||
const expected = { "manifest.json": manifestJson, "content.js": contentScript, "background.js": backgroundScript, "spa-page.js": spaPageScript };
|
||||
for (const [file, contents] of Object.entries(expected)) {
|
||||
const actual = await readFile(path.join(distDir, target.name, file), "utf8");
|
||||
if (actual !== contents) throw new Error(`Stale output: dist/${target.name}/${file}. Run npm run build.`);
|
||||
@@ -82,6 +89,7 @@ for (const target of targets) {
|
||||
await mkdir(outputDir, { recursive: true });
|
||||
await output.writeOutput(path.join(outputDir, "content.js"), contentScript);
|
||||
await output.writeOutput(path.join(outputDir, "background.js"), backgroundScript);
|
||||
await output.writeOutput(path.join(outputDir, "spa-page.js"), spaPageScript);
|
||||
await output.writeOutput(path.join(outputDir, "manifest.json"), manifestJson);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user