@kispace-io/gs-lib 1.1.4 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-map-builder.d.ts +7 -4
- package/dist/base-map-builder.d.ts.map +1 -1
- package/dist/index.js +31 -16
- package/dist/index.js.map +1 -1
- package/dist/pwa/sw.js +16 -1
- package/lib/node-map-builder.ts +12 -3
- package/package.json +1 -1
- package/public/pwa/sw.js +16 -1
- package/src/base-map-builder.ts +41 -19
|
@@ -61,17 +61,20 @@ export declare function processServiceWorker(content: string, precacheManifest?:
|
|
|
61
61
|
*/
|
|
62
62
|
export declare function processManifest(content: string, title: string, version: string): string;
|
|
63
63
|
/**
|
|
64
|
-
* Process HTML template by replacing title placeholder and app.
|
|
64
|
+
* Process HTML template by replacing title placeholder, app.js reference, and app.css reference
|
|
65
65
|
*/
|
|
66
|
-
export declare function processHtml(content: string, title: string, appJsFilename?: string): string;
|
|
66
|
+
export declare function processHtml(content: string, title: string, appJsFilename?: string, appCssFilename?: string): string;
|
|
67
67
|
/**
|
|
68
68
|
* Bundle the application code using esbuild with hashed filenames
|
|
69
69
|
* @param esbuildInstance - The esbuild instance to use (esbuild-wasm for browser, esbuild for Node.js)
|
|
70
|
-
* @returns
|
|
70
|
+
* @returns Object with both JS and CSS filenames (CSS may be null if not generated)
|
|
71
71
|
*/
|
|
72
72
|
export declare function bundleApp(entryPointPath: string, outputDir: string, gsLibPath: string, fileSys: FileSystem, resolvePlugin: EsbuildPlugin, esbuildInstance: EsbuildInstance, progress?: ProgressCallback, currentStep?: {
|
|
73
73
|
value: number;
|
|
74
|
-
}, totalSteps?: number): Promise<
|
|
74
|
+
}, totalSteps?: number): Promise<{
|
|
75
|
+
js: string;
|
|
76
|
+
css: string | null;
|
|
77
|
+
}>;
|
|
75
78
|
/**
|
|
76
79
|
* Interface for copying files from gs-lib package
|
|
77
80
|
* This abstracts the difference between browser (import promises) and Node.js (file system)
|
|
@@ -1 +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O,GACzB,MAAM,CAUR;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,UAAU,GAAG,CAAC,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAM1I;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAC1B,OAAO,EAAE,YAAY,EACrB,EAAE,EAAE,UAAU,EACd,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAChC,MAAM,GAAE;IACJ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5F,EACN,QAAQ,CAAC,EAAE,gBAAgB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAkJf"}
|
package/dist/index.js
CHANGED
|
@@ -99295,6 +99295,7 @@ function generateAppJs(vars) {
|
|
|
99295
99295
|
}).join(",\n ");
|
|
99296
99296
|
return `
|
|
99297
99297
|
import {gsLib} from "${vars.gsLibPath}"
|
|
99298
|
+
import "./gs-lib/gs-lib.css"
|
|
99298
99299
|
|
|
99299
99300
|
${scriptImports.join("\n")}
|
|
99300
99301
|
|
|
@@ -99343,11 +99344,14 @@ function processManifest(content, title, version) {
|
|
|
99343
99344
|
manifest.version = version;
|
|
99344
99345
|
return JSON.stringify(manifest, null, 2);
|
|
99345
99346
|
}
|
|
99346
|
-
function processHtml(content, title, appJsFilename) {
|
|
99347
|
+
function processHtml(content, title, appJsFilename, appCssFilename) {
|
|
99347
99348
|
let processed = content.replace(/\$TITLE/g, title);
|
|
99348
99349
|
if (appJsFilename) {
|
|
99349
99350
|
processed = processed.replace(/\.\/app\.js/g, `./${appJsFilename}`);
|
|
99350
99351
|
}
|
|
99352
|
+
if (appCssFilename) {
|
|
99353
|
+
processed = processed.replace(/href=["']app\.css["']/g, `href="${appCssFilename}"`);
|
|
99354
|
+
}
|
|
99351
99355
|
return processed;
|
|
99352
99356
|
}
|
|
99353
99357
|
async function bundleApp(entryPointPath, outputDir, gsLibPath, fileSys, resolvePlugin, esbuildInstance, progress, currentStep, totalSteps) {
|
|
@@ -99383,18 +99387,22 @@ async function bundleApp(entryPointPath, outputDir, gsLibPath, fileSys, resolveP
|
|
|
99383
99387
|
throw new Error("No output files generated by esbuild");
|
|
99384
99388
|
}
|
|
99385
99389
|
let mainOutputFile = null;
|
|
99390
|
+
let cssOutputFile = null;
|
|
99386
99391
|
if (result.metafile && result.metafile.outputs) {
|
|
99387
99392
|
const entryName = "app";
|
|
99388
99393
|
for (const [outputPath, output] of Object.entries(result.metafile.outputs)) {
|
|
99389
|
-
if (output && typeof output === "object" && "entryPoint" in output
|
|
99390
|
-
|
|
99391
|
-
|
|
99394
|
+
if (output && typeof output === "object" && "entryPoint" in output) {
|
|
99395
|
+
if (outputPath.includes(entryName) && outputPath.endsWith(".js")) {
|
|
99396
|
+
mainOutputFile = outputPath;
|
|
99397
|
+
} else if (outputPath.endsWith(".css")) {
|
|
99398
|
+
cssOutputFile = outputPath;
|
|
99399
|
+
}
|
|
99392
99400
|
}
|
|
99393
99401
|
}
|
|
99394
99402
|
}
|
|
99403
|
+
const path = await Promise.resolve().then(() => __viteBrowserExternal);
|
|
99395
99404
|
for (const file of result.outputFiles) {
|
|
99396
99405
|
let filePath = file.path || "";
|
|
99397
|
-
const path = await Promise.resolve().then(() => __viteBrowserExternal);
|
|
99398
99406
|
let relativePath;
|
|
99399
99407
|
let filename;
|
|
99400
99408
|
if (filePath.startsWith("/") || filePath.length > 2 && filePath[1] === ":") {
|
|
@@ -99408,12 +99416,21 @@ async function bundleApp(entryPointPath, outputDir, gsLibPath, fileSys, resolveP
|
|
|
99408
99416
|
if (!mainOutputFile && filename.includes("app-") && filename.endsWith(".js")) {
|
|
99409
99417
|
mainOutputFile = filename;
|
|
99410
99418
|
}
|
|
99419
|
+
if (!cssOutputFile && filename.includes("app-") && filename.endsWith(".css")) {
|
|
99420
|
+
cssOutputFile = filename;
|
|
99421
|
+
}
|
|
99411
99422
|
}
|
|
99412
99423
|
if (!mainOutputFile) {
|
|
99413
99424
|
throw new Error("Could not find main output file");
|
|
99414
99425
|
}
|
|
99415
|
-
const
|
|
99416
|
-
|
|
99426
|
+
const extractFilename = (filePath) => {
|
|
99427
|
+
const lastSlash = Math.max(filePath.lastIndexOf("/"), filePath.lastIndexOf("\\"));
|
|
99428
|
+
return lastSlash >= 0 ? filePath.substring(lastSlash + 1) : filePath;
|
|
99429
|
+
};
|
|
99430
|
+
return {
|
|
99431
|
+
js: extractFilename(mainOutputFile),
|
|
99432
|
+
css: cssOutputFile ? extractFilename(cssOutputFile) : null
|
|
99433
|
+
};
|
|
99417
99434
|
}
|
|
99418
99435
|
function createFileSystemGsLibCopier(fs2, gsLibPackagePath) {
|
|
99419
99436
|
const copyFile = async (srcPath, destPath, asText, processor) => {
|
|
@@ -99496,7 +99513,7 @@ async function buildMap(options, fs2, resolvePlugin, esbuildInstance, config = {
|
|
|
99496
99513
|
updateProgress("Copying gs-lib package...");
|
|
99497
99514
|
await Promise.all([
|
|
99498
99515
|
gsLibCopier.copyTextFile("dist/index.js", `${buildDir}/gs-lib/index.js`),
|
|
99499
|
-
gsLibCopier.copyTextFile("dist/gs-lib.css", `${
|
|
99516
|
+
gsLibCopier.copyTextFile("dist/gs-lib.css", `${buildDir}/gs-lib/gs-lib.css`)
|
|
99500
99517
|
]);
|
|
99501
99518
|
updateProgress("Copying PWA core files...");
|
|
99502
99519
|
await gsLibCopier.copyTextFile("public/pwa/staticwebapp.config.json", `${outputDir}/staticwebapp.config.json`);
|
|
@@ -99528,19 +99545,17 @@ async function buildMap(options, fs2, resolvePlugin, esbuildInstance, config = {
|
|
|
99528
99545
|
});
|
|
99529
99546
|
await fs2.writeFile(`${buildDir}/app.js`, entryPointContent);
|
|
99530
99547
|
const stepRef = { value: step };
|
|
99531
|
-
const
|
|
99548
|
+
const bundleResult = await bundleApp(`${buildDir}/app.js`, outputDir, buildGsLibPath, fs2, resolvePlugin, esbuildInstance, progress, stepRef, totalSteps);
|
|
99532
99549
|
step = stepRef.value;
|
|
99550
|
+
const appJsFilename = bundleResult.js;
|
|
99551
|
+
const appCssFilename = bundleResult.css;
|
|
99533
99552
|
updateProgress("Generating HTML file...");
|
|
99534
|
-
await gsLibCopier.copyTextFile("public/index.html", `${outputDir}/index.html`, (content) => processHtml(content, options.title, appJsFilename));
|
|
99553
|
+
await gsLibCopier.copyTextFile("public/index.html", `${outputDir}/index.html`, (content) => processHtml(content, options.title, appJsFilename, appCssFilename || void 0));
|
|
99535
99554
|
const precacheManifest = [
|
|
99536
99555
|
{ url: `/${appJsFilename}`, revision: null },
|
|
99537
99556
|
// Hashed filename handles versioning
|
|
99538
|
-
{ url:
|
|
99539
|
-
//
|
|
99540
|
-
{ url: "/app.css", revision: null },
|
|
99541
|
-
// Workbox will check file content
|
|
99542
|
-
{ url: "/manifest.json", revision: null },
|
|
99543
|
-
// Workbox will check file content
|
|
99557
|
+
...appCssFilename ? [{ url: `/${appCssFilename}`, revision: null }] : [],
|
|
99558
|
+
// Hashed CSS filename handles versioning
|
|
99544
99559
|
...iconFiles.map((icon) => ({ url: `/assets/icons/${icon}`, revision: null }))
|
|
99545
99560
|
// Workbox will check file content
|
|
99546
99561
|
];
|