Add progressive web app companion for cross-platform access

Vite + TypeScript PWA that mirrors the Android app's core features:
- Pre-processed shelter data (build-time UTM33N→WGS84 conversion)
- Leaflet map with shelter markers, user location, and offline tiles
- Canvas compass arrow (ported from DirectionArrowView.kt)
- IndexedDB shelter cache with 7-day staleness check
- Service worker with CacheFirst tiles and precached app shell
- i18n for en, nb, nn (ported from Android strings.xml)
- iOS/Android compass handling with low-pass filter
- Respects user map interaction (no auto-snap on pan/zoom)
- Build revision cache-breaker for reliable SW updates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2026-03-08 17:41:38 +01:00
commit e8428de775
12051 changed files with 1799735 additions and 0 deletions

19
pwa/node_modules/workbox-build/.ncurc.js generated vendored Normal file
View file

@ -0,0 +1,19 @@
/*
Copyright 2020 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
// We use `npx npm-check-updates` to find updates to dependencies.
// Some dependencies have breaking changes that we can't resolve.
// This config file excludes those dependencies from the checks
// until we're able to remediate our code to deal with them.
module.exports = {
reject: [
// joi v16 is the last release to support Node v10:
// https://github.com/sideway/joi/issues/2262
'@hapi/joi',
],
};

19
pwa/node_modules/workbox-build/LICENSE generated vendored Normal file
View file

@ -0,0 +1,19 @@
Copyright 2018 Google LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

1
pwa/node_modules/workbox-build/README.md generated vendored Normal file
View file

@ -0,0 +1 @@
This module's documentation can be found at https://developer.chrome.com/docs/workbox/modules/workbox-build

View file

@ -0,0 +1,6 @@
{
"origin": "https://storage.googleapis.com",
"bucketName": "workbox-cdn",
"releasesDir": "releases",
"latestVersion": "7.4.0"
}

47
pwa/node_modules/workbox-build/build/generate-sw.d.ts generated vendored Normal file
View file

@ -0,0 +1,47 @@
import { BuildResult, GenerateSWOptions } from './types';
/**
* This method creates a list of URLs to precache, referred to as a "precache
* manifest", based on the options you provide.
*
* It also takes in additional options that configures the service worker's
* behavior, like any `runtimeCaching` rules it should use.
*
* Based on the precache manifest and the additional configuration, it writes
* a ready-to-use service worker file to disk at `swDest`.
*
* ```
* // The following lists some common options; see the rest of the documentation
* // for the full set of options and defaults.
* const {count, size, warnings} = await generateSW({
* dontCacheBustURLsMatching: [new RegExp('...')],
* globDirectory: '...',
* globPatterns: ['...', '...'],
* maximumFileSizeToCacheInBytes: ...,
* navigateFallback: '...',
* runtimeCaching: [{
* // Routing via a matchCallback function:
* urlPattern: ({request, url}) => ...,
* handler: '...',
* options: {
* cacheName: '...',
* expiration: {
* maxEntries: ...,
* },
* },
* }, {
* // Routing via a RegExp:
* urlPattern: new RegExp('...'),
* handler: '...',
* options: {
* cacheName: '...',
* plugins: [..., ...],
* },
* }],
* skipWaiting: ...,
* swDest: '...',
* });
* ```
*
* @memberof workbox-build
*/
export declare function generateSW(config: GenerateSWOptions): Promise<BuildResult>;

105
pwa/node_modules/workbox-build/build/generate-sw.js generated vendored Normal file
View file

@ -0,0 +1,105 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateSW = void 0;
const upath_1 = __importDefault(require("upath"));
const get_file_manifest_entries_1 = require("./lib/get-file-manifest-entries");
const rebase_path_1 = require("./lib/rebase-path");
const validate_options_1 = require("./lib/validate-options");
const write_sw_using_default_template_1 = require("./lib/write-sw-using-default-template");
/**
* This method creates a list of URLs to precache, referred to as a "precache
* manifest", based on the options you provide.
*
* It also takes in additional options that configures the service worker's
* behavior, like any `runtimeCaching` rules it should use.
*
* Based on the precache manifest and the additional configuration, it writes
* a ready-to-use service worker file to disk at `swDest`.
*
* ```
* // The following lists some common options; see the rest of the documentation
* // for the full set of options and defaults.
* const {count, size, warnings} = await generateSW({
* dontCacheBustURLsMatching: [new RegExp('...')],
* globDirectory: '...',
* globPatterns: ['...', '...'],
* maximumFileSizeToCacheInBytes: ...,
* navigateFallback: '...',
* runtimeCaching: [{
* // Routing via a matchCallback function:
* urlPattern: ({request, url}) => ...,
* handler: '...',
* options: {
* cacheName: '...',
* expiration: {
* maxEntries: ...,
* },
* },
* }, {
* // Routing via a RegExp:
* urlPattern: new RegExp('...'),
* handler: '...',
* options: {
* cacheName: '...',
* plugins: [..., ...],
* },
* }],
* skipWaiting: ...,
* swDest: '...',
* });
* ```
*
* @memberof workbox-build
*/
async function generateSW(config) {
const options = (0, validate_options_1.validateGenerateSWOptions)(config);
let entriesResult;
if (options.globDirectory) {
// Make sure we leave swDest out of the precache manifest.
options.globIgnores.push((0, rebase_path_1.rebasePath)({
baseDirectory: options.globDirectory,
file: options.swDest,
}));
// If we create an extra external runtime file, ignore that, too.
// See https://rollupjs.org/guide/en/#outputchunkfilenames for naming.
if (!options.inlineWorkboxRuntime) {
const swDestDir = upath_1.default.dirname(options.swDest);
const workboxRuntimeFile = upath_1.default.join(swDestDir, 'workbox-*.js');
options.globIgnores.push((0, rebase_path_1.rebasePath)({
baseDirectory: options.globDirectory,
file: workboxRuntimeFile,
}));
}
// We've previously asserted that options.globDirectory is set, so this
// should be a safe cast.
entriesResult = await (0, get_file_manifest_entries_1.getFileManifestEntries)(options);
}
else {
entriesResult = {
count: 0,
manifestEntries: [],
size: 0,
warnings: [],
};
}
const filePaths = await (0, write_sw_using_default_template_1.writeSWUsingDefaultTemplate)(Object.assign({
manifestEntries: entriesResult.manifestEntries,
}, options));
return {
filePaths,
count: entriesResult.count,
size: entriesResult.size,
warnings: entriesResult.warnings,
};
}
exports.generateSW = generateSW;

20
pwa/node_modules/workbox-build/build/get-manifest.d.ts generated vendored Normal file
View file

@ -0,0 +1,20 @@
import { GetManifestOptions, GetManifestResult } from './types';
/**
* This method returns a list of URLs to precache, referred to as a "precache
* manifest", along with details about the number of entries and their size,
* based on the options you provide.
*
* ```
* // The following lists some common options; see the rest of the documentation
* // for the full set of options and defaults.
* const {count, manifestEntries, size, warnings} = await getManifest({
* dontCacheBustURLsMatching: [new RegExp('...')],
* globDirectory: '...',
* globPatterns: ['...', '...'],
* maximumFileSizeToCacheInBytes: ...,
* });
* ```
*
* @memberof workbox-build
*/
export declare function getManifest(config: GetManifestOptions): Promise<GetManifestResult>;

35
pwa/node_modules/workbox-build/build/get-manifest.js generated vendored Normal file
View file

@ -0,0 +1,35 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getManifest = void 0;
const get_file_manifest_entries_1 = require("./lib/get-file-manifest-entries");
const validate_options_1 = require("./lib/validate-options");
/**
* This method returns a list of URLs to precache, referred to as a "precache
* manifest", along with details about the number of entries and their size,
* based on the options you provide.
*
* ```
* // The following lists some common options; see the rest of the documentation
* // for the full set of options and defaults.
* const {count, manifestEntries, size, warnings} = await getManifest({
* dontCacheBustURLsMatching: [new RegExp('...')],
* globDirectory: '...',
* globPatterns: ['...', '...'],
* maximumFileSizeToCacheInBytes: ...,
* });
* ```
*
* @memberof workbox-build
*/
async function getManifest(config) {
const options = (0, validate_options_1.validateGetManifestOptions)(config);
return await (0, get_file_manifest_entries_1.getFileManifestEntries)(options);
}
exports.getManifest = getManifest;

10
pwa/node_modules/workbox-build/build/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,10 @@
import { copyWorkboxLibraries } from './lib/copy-workbox-libraries';
import { getModuleURL } from './lib/cdn-utils';
import { generateSW } from './generate-sw';
import { getManifest } from './get-manifest';
import { injectManifest } from './inject-manifest';
/**
* @module workbox-build
*/
export { copyWorkboxLibraries, generateSW, getManifest, getModuleURL, injectManifest, };
export * from './types';

35
pwa/node_modules/workbox-build/build/index.js generated vendored Normal file
View file

@ -0,0 +1,35 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.injectManifest = exports.getModuleURL = exports.getManifest = exports.generateSW = exports.copyWorkboxLibraries = void 0;
const copy_workbox_libraries_1 = require("./lib/copy-workbox-libraries");
Object.defineProperty(exports, "copyWorkboxLibraries", { enumerable: true, get: function () { return copy_workbox_libraries_1.copyWorkboxLibraries; } });
const cdn_utils_1 = require("./lib/cdn-utils");
Object.defineProperty(exports, "getModuleURL", { enumerable: true, get: function () { return cdn_utils_1.getModuleURL; } });
const generate_sw_1 = require("./generate-sw");
Object.defineProperty(exports, "generateSW", { enumerable: true, get: function () { return generate_sw_1.generateSW; } });
const get_manifest_1 = require("./get-manifest");
Object.defineProperty(exports, "getManifest", { enumerable: true, get: function () { return get_manifest_1.getManifest; } });
const inject_manifest_1 = require("./inject-manifest");
Object.defineProperty(exports, "injectManifest", { enumerable: true, get: function () { return inject_manifest_1.injectManifest; } });
__exportStar(require("./types"), exports);

View file

@ -0,0 +1,30 @@
import { BuildResult, InjectManifestOptions } from './types';
/**
* This method creates a list of URLs to precache, referred to as a "precache
* manifest", based on the options you provide.
*
* The manifest is injected into the `swSrc` file, and the placeholder string
* `injectionPoint` determines where in the file the manifest should go.
*
* The final service worker file, with the manifest injected, is written to
* disk at `swDest`.
*
* This method will not compile or bundle your `swSrc` file; it just handles
* injecting the manifest.
*
* ```
* // The following lists some common options; see the rest of the documentation
* // for the full set of options and defaults.
* const {count, size, warnings} = await injectManifest({
* dontCacheBustURLsMatching: [new RegExp('...')],
* globDirectory: '...',
* globPatterns: ['...', '...'],
* maximumFileSizeToCacheInBytes: ...,
* swDest: '...',
* swSrc: '...',
* });
* ```
*
* @memberof workbox-build
*/
export declare function injectManifest(config: InjectManifestOptions): Promise<BuildResult>;

133
pwa/node_modules/workbox-build/build/inject-manifest.js generated vendored Normal file
View file

@ -0,0 +1,133 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.injectManifest = void 0;
const assert_1 = __importDefault(require("assert"));
const fs_extra_1 = __importDefault(require("fs-extra"));
const fast_json_stable_stringify_1 = __importDefault(require("fast-json-stable-stringify"));
const upath_1 = __importDefault(require("upath"));
const errors_1 = require("./lib/errors");
const escape_regexp_1 = require("./lib/escape-regexp");
const get_file_manifest_entries_1 = require("./lib/get-file-manifest-entries");
const get_source_map_url_1 = require("./lib/get-source-map-url");
const rebase_path_1 = require("./lib/rebase-path");
const replace_and_update_source_map_1 = require("./lib/replace-and-update-source-map");
const translate_url_to_sourcemap_paths_1 = require("./lib/translate-url-to-sourcemap-paths");
const validate_options_1 = require("./lib/validate-options");
/**
* This method creates a list of URLs to precache, referred to as a "precache
* manifest", based on the options you provide.
*
* The manifest is injected into the `swSrc` file, and the placeholder string
* `injectionPoint` determines where in the file the manifest should go.
*
* The final service worker file, with the manifest injected, is written to
* disk at `swDest`.
*
* This method will not compile or bundle your `swSrc` file; it just handles
* injecting the manifest.
*
* ```
* // The following lists some common options; see the rest of the documentation
* // for the full set of options and defaults.
* const {count, size, warnings} = await injectManifest({
* dontCacheBustURLsMatching: [new RegExp('...')],
* globDirectory: '...',
* globPatterns: ['...', '...'],
* maximumFileSizeToCacheInBytes: ...,
* swDest: '...',
* swSrc: '...',
* });
* ```
*
* @memberof workbox-build
*/
async function injectManifest(config) {
const options = (0, validate_options_1.validateInjectManifestOptions)(config);
// Make sure we leave swSrc and swDest out of the precache manifest.
for (const file of [options.swSrc, options.swDest]) {
options.globIgnores.push((0, rebase_path_1.rebasePath)({
file,
baseDirectory: options.globDirectory,
}));
}
const globalRegexp = new RegExp((0, escape_regexp_1.escapeRegExp)(options.injectionPoint), 'g');
const { count, size, manifestEntries, warnings } = await (0, get_file_manifest_entries_1.getFileManifestEntries)(options);
let swFileContents;
try {
swFileContents = await fs_extra_1.default.readFile(options.swSrc, 'utf8');
}
catch (error) {
throw new Error(`${errors_1.errors['invalid-sw-src']} ${error instanceof Error && error.message ? error.message : ''}`);
}
const injectionResults = swFileContents.match(globalRegexp);
// See https://github.com/GoogleChrome/workbox/issues/2230
const injectionPoint = options.injectionPoint ? options.injectionPoint : '';
if (!injectionResults) {
if (upath_1.default.resolve(options.swSrc) === upath_1.default.resolve(options.swDest)) {
throw new Error(`${errors_1.errors['same-src-and-dest']} ${injectionPoint}`);
}
throw new Error(`${errors_1.errors['injection-point-not-found']} ${injectionPoint}`);
}
(0, assert_1.default)(injectionResults.length === 1, `${errors_1.errors['multiple-injection-points']} ${injectionPoint}`);
const manifestString = (0, fast_json_stable_stringify_1.default)(manifestEntries);
const filesToWrite = {};
const url = (0, get_source_map_url_1.getSourceMapURL)(swFileContents);
// See https://github.com/GoogleChrome/workbox/issues/2957
const { destPath, srcPath, warning } = (0, translate_url_to_sourcemap_paths_1.translateURLToSourcemapPaths)(url, options.swSrc, options.swDest);
if (warning) {
warnings.push(warning);
}
// If our swSrc file contains a sourcemap, we would invalidate that
// mapping if we just replaced injectionPoint with the stringified manifest.
// Instead, we need to update the swDest contents as well as the sourcemap
// (assuming it's a real file, not a data: URL) at the same time.
// See https://github.com/GoogleChrome/workbox/issues/2235
// and https://github.com/GoogleChrome/workbox/issues/2648
if (srcPath && destPath) {
const originalMap = (await fs_extra_1.default.readJSON(srcPath, {
encoding: 'utf8',
}));
const { map, source } = await (0, replace_and_update_source_map_1.replaceAndUpdateSourceMap)({
originalMap,
jsFilename: upath_1.default.basename(options.swDest),
originalSource: swFileContents,
replaceString: manifestString,
searchString: options.injectionPoint,
});
filesToWrite[options.swDest] = source;
filesToWrite[destPath] = map;
}
else {
// If there's no sourcemap associated with swSrc, a simple string
// replacement will suffice.
filesToWrite[options.swDest] = swFileContents.replace(globalRegexp, manifestString);
}
for (const [file, contents] of Object.entries(filesToWrite)) {
try {
await fs_extra_1.default.mkdirp(upath_1.default.dirname(file));
}
catch (error) {
throw new Error(errors_1.errors['unable-to-make-sw-directory'] +
` '${error instanceof Error && error.message ? error.message : ''}'`);
}
await fs_extra_1.default.writeFile(file, contents);
}
return {
count,
size,
warnings,
// Use upath.resolve() to make all the paths absolute.
filePaths: Object.keys(filesToWrite).map((f) => upath_1.default.resolve(f)),
};
}
exports.injectManifest = injectManifest;

View file

@ -0,0 +1,13 @@
import { ManifestEntry } from '../types';
type AdditionalManifestEntriesTransform = {
(manifest: Array<ManifestEntry & {
size: number;
}>): {
manifest: Array<ManifestEntry & {
size: number;
}>;
warnings: string[];
};
};
export declare function additionalManifestEntriesTransform(additionalManifestEntries: Array<ManifestEntry | string>): AdditionalManifestEntriesTransform;
export {};

View file

@ -0,0 +1,47 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.additionalManifestEntriesTransform = void 0;
const errors_1 = require("./errors");
function additionalManifestEntriesTransform(additionalManifestEntries) {
return (manifest) => {
const warnings = [];
const stringEntries = new Set();
for (const additionalEntry of additionalManifestEntries) {
// Warn about either a string or an object that lacks a revision property.
// (An object with a revision property set to null is okay.)
if (typeof additionalEntry === 'string') {
stringEntries.add(additionalEntry);
manifest.push({
revision: null,
size: 0,
url: additionalEntry,
});
}
else {
if (additionalEntry && additionalEntry.revision === undefined) {
stringEntries.add(additionalEntry.url);
}
manifest.push(Object.assign({ size: 0 }, additionalEntry));
}
}
if (stringEntries.size > 0) {
let urls = '\n';
for (const stringEntry of stringEntries) {
urls += ` - ${stringEntry}\n`;
}
warnings.push(errors_1.errors['string-entry-warning'] + urls);
}
return {
manifest,
warnings,
};
};
}
exports.additionalManifestEntriesTransform = additionalManifestEntriesTransform;

9
pwa/node_modules/workbox-build/build/lib/bundle.d.ts generated vendored Normal file
View file

@ -0,0 +1,9 @@
import { GeneratePartial, RequiredSWDestPartial } from '../types';
interface NameAndContents {
contents: string | Uint8Array;
name: string;
}
export declare function bundle({ babelPresetEnvTargets, inlineWorkboxRuntime, mode, sourcemap, swDest, unbundledCode, }: Omit<GeneratePartial, 'runtimeCaching'> & RequiredSWDestPartial & {
unbundledCode: string;
}): Promise<Array<NameAndContents>>;
export {};

123
pwa/node_modules/workbox-build/build/lib/bundle.js generated vendored Normal file
View file

@ -0,0 +1,123 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.bundle = void 0;
const plugin_babel_1 = require("@rollup/plugin-babel");
const plugin_node_resolve_1 = require("@rollup/plugin-node-resolve");
const rollup_1 = require("rollup");
const plugin_terser_1 = __importDefault(require("@rollup/plugin-terser"));
const fs_extra_1 = require("fs-extra");
const rollup_plugin_off_main_thread_1 = __importDefault(require("@surma/rollup-plugin-off-main-thread"));
const preset_env_1 = __importDefault(require("@babel/preset-env"));
const plugin_replace_1 = __importDefault(require("@rollup/plugin-replace"));
const tempy_1 = __importDefault(require("tempy"));
const upath_1 = __importDefault(require("upath"));
async function bundle({ babelPresetEnvTargets, inlineWorkboxRuntime, mode, sourcemap, swDest, unbundledCode, }) {
// We need to write this to the "real" file system, as Rollup won't read from
// a custom file system.
const { dir, base } = upath_1.default.parse(swDest);
const temporaryFile = tempy_1.default.file({ name: base });
await (0, fs_extra_1.writeFile)(temporaryFile, unbundledCode);
const plugins = [
(0, plugin_node_resolve_1.nodeResolve)(),
(0, plugin_replace_1.default)({
// See https://github.com/GoogleChrome/workbox/issues/2769
'preventAssignment': true,
'process.env.NODE_ENV': JSON.stringify(mode),
}),
(0, plugin_babel_1.babel)({
babelHelpers: 'bundled',
// Disable the logic that checks for local Babel config files:
// https://github.com/GoogleChrome/workbox/issues/2111
babelrc: false,
configFile: false,
presets: [
[
preset_env_1.default,
{
targets: {
browsers: babelPresetEnvTargets,
},
loose: true,
},
],
],
}),
];
if (mode === 'production') {
plugins.push((0, plugin_terser_1.default)({
mangle: {
toplevel: true,
properties: {
regex: /(^_|_$)/,
},
},
}));
}
const rollupConfig = {
plugins,
input: temporaryFile,
};
// Rollup will inline the runtime by default. If we don't want that, we need
// to add in some additional config.
if (!inlineWorkboxRuntime) {
// No lint for omt(), library has no types.
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
rollupConfig.plugins.unshift((0, rollup_plugin_off_main_thread_1.default)());
rollupConfig.manualChunks = (id) => {
return id.includes('workbox') ? 'workbox' : undefined;
};
}
const bundle = await (0, rollup_1.rollup)(rollupConfig);
const { output } = await bundle.generate({
sourcemap,
// Using an external Workbox runtime requires 'amd'.
format: inlineWorkboxRuntime ? 'es' : 'amd',
});
const files = [];
for (const chunkOrAsset of output) {
if (chunkOrAsset.type === 'asset') {
files.push({
name: chunkOrAsset.fileName,
contents: chunkOrAsset.source,
});
}
else {
let code = chunkOrAsset.code;
if (chunkOrAsset.map) {
const sourceMapFile = chunkOrAsset.fileName + '.map';
code += `//# sourceMappingURL=${sourceMapFile}\n`;
files.push({
name: sourceMapFile,
contents: chunkOrAsset.map.toString(),
});
}
files.push({
name: chunkOrAsset.fileName,
contents: code,
});
}
}
// Make sure that if there was a directory portion included in swDest, it's
// preprended to all of the generated files.
return files.map((file) => {
file.name = upath_1.default.format({
dir,
base: file.name,
ext: '',
name: '',
root: '',
});
return file;
});
}
exports.bundle = bundle;

View file

@ -0,0 +1,2 @@
import { BuildType } from '../types';
export declare function getModuleURL(moduleName: string, buildType: BuildType): string;

57
pwa/node_modules/workbox-build/build/lib/cdn-utils.js generated vendored Normal file
View file

@ -0,0 +1,57 @@
"use strict";
/*
Copyright 2021 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getModuleURL = void 0;
const assert_1 = require("assert");
const errors_1 = require("./errors");
const cdn = __importStar(require("../cdn-details.json"));
function getVersionedURL() {
return `${getCDNPrefix()}/${cdn.latestVersion}`;
}
function getCDNPrefix() {
return `${cdn.origin}/${cdn.bucketName}/${cdn.releasesDir}`;
}
function getModuleURL(moduleName, buildType) {
(0, assert_1.ok)(moduleName, errors_1.errors['no-module-name']);
if (buildType) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const pkgJson = require(`${moduleName}/package.json`);
if (buildType === 'dev' && pkgJson.workbox && pkgJson.workbox.prodOnly) {
// This is not due to a public-facing exception, so just throw an Error(),
// without creating an entry in errors.js.
throw Error(`The 'dev' build of ${moduleName} is not available.`);
}
return `${getVersionedURL()}/${moduleName}.${buildType.slice(0, 4)}.js`;
}
return `${getVersionedURL()}/${moduleName}.js`;
}
exports.getModuleURL = getModuleURL;

View file

@ -0,0 +1,20 @@
/**
* This copies over a set of runtime libraries used by Workbox into a
* local directory, which should be deployed alongside your service worker file.
*
* As an alternative to deploying these local copies, you could instead use
* Workbox from its official CDN URL.
*
* This method is exposed for the benefit of developers using
* {@link workbox-build.injectManifest} who would
* prefer not to use the CDN copies of Workbox. Developers using
* {@link workbox-build.generateSW} don't need to
* explicitly call this method.
*
* @param {string} destDirectory The path to the parent directory under which
* the new directory of libraries will be created.
* @return {Promise<string>} The name of the newly created directory.
*
* @alias workbox-build.copyWorkboxLibraries
*/
export declare function copyWorkboxLibraries(destDirectory: string): Promise<string>;

View file

@ -0,0 +1,69 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.copyWorkboxLibraries = void 0;
const fs_extra_1 = __importDefault(require("fs-extra"));
const upath_1 = __importDefault(require("upath"));
const errors_1 = require("./errors");
// Used to filter the libraries to copy based on our package.json dependencies.
const WORKBOX_PREFIX = 'workbox-';
// The directory within each package containing the final bundles.
const BUILD_DIR = 'build';
/**
* This copies over a set of runtime libraries used by Workbox into a
* local directory, which should be deployed alongside your service worker file.
*
* As an alternative to deploying these local copies, you could instead use
* Workbox from its official CDN URL.
*
* This method is exposed for the benefit of developers using
* {@link workbox-build.injectManifest} who would
* prefer not to use the CDN copies of Workbox. Developers using
* {@link workbox-build.generateSW} don't need to
* explicitly call this method.
*
* @param {string} destDirectory The path to the parent directory under which
* the new directory of libraries will be created.
* @return {Promise<string>} The name of the newly created directory.
*
* @alias workbox-build.copyWorkboxLibraries
*/
async function copyWorkboxLibraries(destDirectory) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const thisPkg = require('../../package.json');
// Use the version string from workbox-build in the name of the parent
// directory. This should be safe, because lerna will bump workbox-build's
// pkg.version whenever one of the dependent libraries gets bumped, and we
// care about versioning the dependent libraries.
const workboxDirectoryName = `workbox-v${thisPkg.version ? thisPkg.version : ''}`;
const workboxDirectoryPath = upath_1.default.join(destDirectory, workboxDirectoryName);
await fs_extra_1.default.ensureDir(workboxDirectoryPath);
const copyPromises = [];
const librariesToCopy = Object.keys(thisPkg.dependencies || {}).filter((dependency) => dependency.startsWith(WORKBOX_PREFIX));
for (const library of librariesToCopy) {
// Get the path to the package on the user's filesystem by require-ing
// the package's `package.json` file via the node resolution algorithm.
const libraryPath = upath_1.default.dirname(require.resolve(`${library}/package.json`));
const buildPath = upath_1.default.join(libraryPath, BUILD_DIR);
// fse.copy() copies all the files in a directory, not the directory itself.
// See https://github.com/jprichardson/node-fs-extra/blob/master/docs/copy.md#copysrc-dest-options-callback
copyPromises.push(fs_extra_1.default.copy(buildPath, workboxDirectoryPath));
}
try {
await Promise.all(copyPromises);
return workboxDirectoryName;
}
catch (error) {
throw Error(`${errors_1.errors['unable-to-copy-workbox-libraries']} ${error instanceof Error ? error.toString() : ''}`);
}
}
exports.copyWorkboxLibraries = copyWorkboxLibraries;

61
pwa/node_modules/workbox-build/build/lib/errors.d.ts generated vendored Normal file
View file

@ -0,0 +1,61 @@
export declare const errors: {
'unable-to-get-rootdir': string;
'no-extension': string;
'invalid-file-manifest-name': string;
'unable-to-get-file-manifest-name': string;
'invalid-sw-dest': string;
'unable-to-get-sw-name': string;
'unable-to-get-save-config': string;
'unable-to-get-file-hash': string;
'unable-to-get-file-size': string;
'unable-to-glob-files': string;
'unable-to-make-manifest-directory': string;
'read-manifest-template-failure': string;
'populating-manifest-tmpl-failed': string;
'manifest-file-write-failure': string;
'unable-to-make-sw-directory': string;
'read-sw-template-failure': string;
'sw-write-failure': string;
'sw-write-failure-directory': string;
'unable-to-copy-workbox-libraries': string;
'invalid-generate-sw-input': string;
'invalid-glob-directory': string;
'invalid-dont-cache-bust': string;
'invalid-exclude-files': string;
'invalid-get-manifest-entries-input': string;
'invalid-manifest-path': string;
'invalid-manifest-entries': string;
'invalid-manifest-format': string;
'invalid-static-file-globs': string;
'invalid-templated-urls': string;
'templated-url-matches-glob': string;
'invalid-glob-ignores': string;
'manifest-entry-bad-url': string;
'modify-url-prefix-bad-prefixes': string;
'invalid-inject-manifest-arg': string;
'injection-point-not-found': string;
'multiple-injection-points': string;
'populating-sw-tmpl-failed': string;
'useless-glob-pattern': string;
'bad-template-urls-asset': string;
'invalid-runtime-caching': string;
'static-file-globs-deprecated': string;
'dynamic-url-deprecated': string;
'urlPattern-is-required': string;
'handler-is-required': string;
'invalid-generate-file-manifest-arg': string;
'invalid-sw-src': string;
'same-src-and-dest': string;
'only-regexp-routes-supported': string;
'bad-runtime-caching-config': string;
'invalid-network-timeout-seconds': string;
'no-module-name': string;
'bad-manifest-transforms-return-value': string;
'string-entry-warning': string;
'no-manifest-entries-or-runtime-caching': string;
'cant-find-sourcemap': string;
'nav-preload-runtime-caching': string;
'cache-name-required': string;
'manifest-transforms': string;
'invalid-handler-string': string;
};

125
pwa/node_modules/workbox-build/build/lib/errors.js generated vendored Normal file
View file

@ -0,0 +1,125 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.errors = void 0;
const common_tags_1 = require("common-tags");
exports.errors = {
'unable-to-get-rootdir': `Unable to get the root directory of your web app.`,
'no-extension': (0, common_tags_1.oneLine) `Unable to detect a usable extension for a file in your web
app directory.`,
'invalid-file-manifest-name': (0, common_tags_1.oneLine) `The File Manifest Name must have at least one
character.`,
'unable-to-get-file-manifest-name': 'Unable to get a file manifest name.',
'invalid-sw-dest': `The 'swDest' value must be a valid path.`,
'unable-to-get-sw-name': 'Unable to get a service worker file name.',
'unable-to-get-save-config': (0, common_tags_1.oneLine) `An error occurred when asking to save details
in a config file.`,
'unable-to-get-file-hash': (0, common_tags_1.oneLine) `An error occurred when attempting to create a
file hash.`,
'unable-to-get-file-size': (0, common_tags_1.oneLine) `An error occurred when attempting to get a file
size.`,
'unable-to-glob-files': 'An error occurred when globbing for files.',
'unable-to-make-manifest-directory': (0, common_tags_1.oneLine) `Unable to make output directory for
file manifest.`,
'read-manifest-template-failure': 'Unable to read template for file manifest',
'populating-manifest-tmpl-failed': (0, common_tags_1.oneLine) `An error occurred when populating the
file manifest template.`,
'manifest-file-write-failure': 'Unable to write the file manifest.',
'unable-to-make-sw-directory': (0, common_tags_1.oneLine) `Unable to make the directories to output
the service worker path.`,
'read-sw-template-failure': (0, common_tags_1.oneLine) `Unable to read the service worker template
file.`,
'sw-write-failure': 'Unable to write the service worker file.',
'sw-write-failure-directory': (0, common_tags_1.oneLine) `Unable to write the service worker file;
'swDest' should be a full path to the file, not a path to a directory.`,
'unable-to-copy-workbox-libraries': (0, common_tags_1.oneLine) `One or more of the Workbox libraries
could not be copied over to the destination directory: `,
'invalid-generate-sw-input': (0, common_tags_1.oneLine) `The input to generateSW() must be an object.`,
'invalid-glob-directory': (0, common_tags_1.oneLine) `The supplied globDirectory must be a path as a
string.`,
'invalid-dont-cache-bust': (0, common_tags_1.oneLine) `The supplied 'dontCacheBustURLsMatching'
parameter must be a RegExp.`,
'invalid-exclude-files': 'The excluded files should be an array of strings.',
'invalid-get-manifest-entries-input': (0, common_tags_1.oneLine) `The input to
'getFileManifestEntries()' must be an object.`,
'invalid-manifest-path': (0, common_tags_1.oneLine) `The supplied manifest path is not a string with
at least one character.`,
'invalid-manifest-entries': (0, common_tags_1.oneLine) `The manifest entries must be an array of
strings or JavaScript objects containing a url parameter.`,
'invalid-manifest-format': (0, common_tags_1.oneLine) `The value of the 'format' option passed to
generateFileManifest() must be either 'iife' (the default) or 'es'.`,
'invalid-static-file-globs': (0, common_tags_1.oneLine) `The 'globPatterns' value must be an array
of strings.`,
'invalid-templated-urls': (0, common_tags_1.oneLine) `The 'templatedURLs' value should be an object
that maps URLs to either a string, or to an array of glob patterns.`,
'templated-url-matches-glob': (0, common_tags_1.oneLine) `One of the 'templatedURLs' URLs is already
being tracked via 'globPatterns': `,
'invalid-glob-ignores': (0, common_tags_1.oneLine) `The 'globIgnores' parameter must be an array of
glob pattern strings.`,
'manifest-entry-bad-url': (0, common_tags_1.oneLine) `The generated manifest contains an entry without
a URL string. This is likely an error with workbox-build.`,
'modify-url-prefix-bad-prefixes': (0, common_tags_1.oneLine) `The 'modifyURLPrefix' parameter must be
an object with string key value pairs.`,
'invalid-inject-manifest-arg': (0, common_tags_1.oneLine) `The input to 'injectManifest()' must be an
object.`,
'injection-point-not-found': (0, common_tags_1.oneLine) `Unable to find a place to inject the manifest.
Please ensure that your service worker file contains the following: `,
'multiple-injection-points': (0, common_tags_1.oneLine) `Please ensure that your 'swSrc' file contains
only one match for the following: `,
'populating-sw-tmpl-failed': (0, common_tags_1.oneLine) `Unable to generate service worker from
template.`,
'useless-glob-pattern': (0, common_tags_1.oneLine) `One of the glob patterns doesn't match any files.
Please remove or fix the following: `,
'bad-template-urls-asset': (0, common_tags_1.oneLine) `There was an issue using one of the provided
'templatedURLs'.`,
'invalid-runtime-caching': (0, common_tags_1.oneLine) `The 'runtimeCaching' parameter must an an
array of objects with at least a 'urlPattern' and 'handler'.`,
'static-file-globs-deprecated': (0, common_tags_1.oneLine) `'staticFileGlobs' is deprecated.
Please use 'globPatterns' instead.`,
'dynamic-url-deprecated': (0, common_tags_1.oneLine) `'dynamicURLToDependencies' is deprecated.
Please use 'templatedURLs' instead.`,
'urlPattern-is-required': (0, common_tags_1.oneLine) `The 'urlPattern' option is required when using
'runtimeCaching'.`,
'handler-is-required': (0, common_tags_1.oneLine) `The 'handler' option is required when using
runtimeCaching.`,
'invalid-generate-file-manifest-arg': (0, common_tags_1.oneLine) `The input to generateFileManifest()
must be an Object.`,
'invalid-sw-src': `The 'swSrc' file can't be read.`,
'same-src-and-dest': (0, common_tags_1.oneLine) `Unable to find a place to inject the manifest. This is
likely because swSrc and swDest are configured to the same file.
Please ensure that your swSrc file contains the following:`,
'only-regexp-routes-supported': (0, common_tags_1.oneLine) `Please use a regular expression object as
the urlPattern parameter. (Express-style routes are not currently
supported.)`,
'bad-runtime-caching-config': (0, common_tags_1.oneLine) `An unknown configuration option was used
with runtimeCaching: `,
'invalid-network-timeout-seconds': (0, common_tags_1.oneLine) `When using networkTimeoutSeconds, you
must set the handler to 'NetworkFirst'.`,
'no-module-name': (0, common_tags_1.oneLine) `You must provide a moduleName parameter when calling
getModuleURL().`,
'bad-manifest-transforms-return-value': (0, common_tags_1.oneLine) `The return value from a
manifestTransform should be an object with 'manifest' and optionally
'warnings' properties.`,
'string-entry-warning': (0, common_tags_1.oneLine) `Some items were passed to additionalManifestEntries
without revisioning info. This is generally NOT safe. Learn more at
https://bit.ly/wb-precache.`,
'no-manifest-entries-or-runtime-caching': (0, common_tags_1.oneLine) `Couldn't find configuration for
either precaching or runtime caching. Please ensure that the various glob
options are set to match one or more files, and/or configure the
runtimeCaching option.`,
'cant-find-sourcemap': (0, common_tags_1.oneLine) `The swSrc file refers to a sourcemap that can't be
opened:`,
'nav-preload-runtime-caching': (0, common_tags_1.oneLine) `When using navigationPreload, you must also
configure a runtimeCaching route that will use the preloaded response.`,
'cache-name-required': (0, common_tags_1.oneLine) `When using cache expiration, you must also
configure a custom cacheName.`,
'manifest-transforms': (0, common_tags_1.oneLine) `When using manifestTransforms, you must provide
an array of functions.`,
'invalid-handler-string': (0, common_tags_1.oneLine) `The handler name provided is not valid: `,
};

View file

@ -0,0 +1 @@
export declare function escapeRegExp(str: string): string;

View file

@ -0,0 +1,15 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.escapeRegExp = void 0;
// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
function escapeRegExp(str) {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
exports.escapeRegExp = escapeRegExp;

View file

@ -0,0 +1,2 @@
import { FileDetails } from '../types';
export declare function getCompositeDetails(compositeURL: string, dependencyDetails: Array<FileDetails>): FileDetails;

View file

@ -0,0 +1,31 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCompositeDetails = void 0;
const crypto_1 = __importDefault(require("crypto"));
function getCompositeDetails(compositeURL, dependencyDetails) {
let totalSize = 0;
let compositeHash = '';
for (const fileDetails of dependencyDetails) {
totalSize += fileDetails.size;
compositeHash += fileDetails.hash;
}
const md5 = crypto_1.default.createHash('md5');
md5.update(compositeHash);
const hashOfHashes = md5.digest('hex');
return {
file: compositeURL,
hash: hashOfHashes,
size: totalSize,
};
}
exports.getCompositeDetails = getCompositeDetails;

View file

@ -0,0 +1,14 @@
import { GlobPartial } from '../types';
interface FileDetails {
file: string;
hash: string;
size: number;
}
export declare function getFileDetails({ globDirectory, globFollow, globIgnores, globPattern, }: Omit<GlobPartial, 'globDirectory' | 'globPatterns' | 'templatedURLs'> & {
globDirectory: string;
globPattern: string;
}): {
globbedFileDetails: Array<FileDetails>;
warning: string;
};
export {};

View file

@ -0,0 +1,54 @@
"use strict";
/*
Copyright 2021 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFileDetails = void 0;
const glob_1 = require("glob");
const upath_1 = __importDefault(require("upath"));
const errors_1 = require("./errors");
const get_file_size_1 = require("./get-file-size");
const get_file_hash_1 = require("./get-file-hash");
function getFileDetails({ globDirectory, globFollow, globIgnores, globPattern, }) {
let globbedFiles;
let warning = '';
try {
globbedFiles = (0, glob_1.globSync)(globPattern, {
cwd: globDirectory,
follow: globFollow,
ignore: globIgnores,
});
}
catch (err) {
throw new Error(errors_1.errors['unable-to-glob-files'] +
` '${err instanceof Error && err.message ? err.message : ''}'`);
}
if (globbedFiles.length === 0) {
warning =
errors_1.errors['useless-glob-pattern'] +
' ' +
JSON.stringify({ globDirectory, globPattern, globIgnores }, null, 2);
}
const globbedFileDetails = [];
for (const file of globbedFiles) {
const fullPath = upath_1.default.join(globDirectory, file);
const fileSize = (0, get_file_size_1.getFileSize)(fullPath);
if (fileSize !== null) {
const fileHash = (0, get_file_hash_1.getFileHash)(fullPath);
globbedFileDetails.push({
file: `${upath_1.default.relative(globDirectory, fullPath)}`,
hash: fileHash,
size: fileSize,
});
}
}
return { globbedFileDetails, warning };
}
exports.getFileDetails = getFileDetails;

View file

@ -0,0 +1 @@
export declare function getFileHash(file: string): string;

View file

@ -0,0 +1,27 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFileHash = void 0;
const fs_extra_1 = __importDefault(require("fs-extra"));
const get_string_hash_1 = require("./get-string-hash");
const errors_1 = require("./errors");
function getFileHash(file) {
try {
const buffer = fs_extra_1.default.readFileSync(file);
return (0, get_string_hash_1.getStringHash)(buffer);
}
catch (err) {
throw new Error(errors_1.errors['unable-to-get-file-hash'] +
` '${err instanceof Error && err.message ? err.message : ''}'`);
}
}
exports.getFileHash = getFileHash;

View file

@ -0,0 +1,2 @@
import { GetManifestResult, GetManifestOptions } from '../types';
export declare function getFileManifestEntries({ additionalManifestEntries, dontCacheBustURLsMatching, globDirectory, globFollow, globIgnores, globPatterns, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, templatedURLs, }: GetManifestOptions): Promise<GetManifestResult>;

View file

@ -0,0 +1,96 @@
"use strict";
/*
Copyright 2021 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFileManifestEntries = void 0;
const assert_1 = __importDefault(require("assert"));
const errors_1 = require("./errors");
const get_composite_details_1 = require("./get-composite-details");
const get_file_details_1 = require("./get-file-details");
const get_string_details_1 = require("./get-string-details");
const transform_manifest_1 = require("./transform-manifest");
async function getFileManifestEntries({ additionalManifestEntries, dontCacheBustURLsMatching, globDirectory, globFollow, globIgnores, globPatterns = [], manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, templatedURLs, }) {
const warnings = [];
const allFileDetails = new Map();
try {
for (const globPattern of globPatterns) {
const { globbedFileDetails, warning } = (0, get_file_details_1.getFileDetails)({
globDirectory,
globFollow,
globIgnores,
globPattern,
});
if (warning) {
warnings.push(warning);
}
for (const details of globbedFileDetails) {
if (details && !allFileDetails.has(details.file)) {
allFileDetails.set(details.file, details);
}
}
}
}
catch (error) {
// If there's an exception thrown while globbing, then report
// it back as a warning, and don't consider it fatal.
if (error instanceof Error && error.message) {
warnings.push(error.message);
}
}
if (templatedURLs) {
for (const url of Object.keys(templatedURLs)) {
(0, assert_1.default)(!allFileDetails.has(url), errors_1.errors['templated-url-matches-glob']);
const dependencies = templatedURLs[url];
if (Array.isArray(dependencies)) {
const details = dependencies.reduce((previous, globPattern) => {
try {
const { globbedFileDetails, warning } = (0, get_file_details_1.getFileDetails)({
globDirectory,
globFollow,
globIgnores,
globPattern,
});
if (warning) {
warnings.push(warning);
}
return previous.concat(globbedFileDetails);
}
catch (error) {
const debugObj = {};
debugObj[url] = dependencies;
throw new Error(`${errors_1.errors['bad-template-urls-asset']} ` +
`'${globPattern}' from '${JSON.stringify(debugObj)}':\n` +
`${error instanceof Error ? error.toString() : ''}`);
}
}, []);
if (details.length === 0) {
throw new Error(`${errors_1.errors['bad-template-urls-asset']} The glob ` +
`pattern '${dependencies.toString()}' did not match anything.`);
}
allFileDetails.set(url, (0, get_composite_details_1.getCompositeDetails)(url, details));
}
else if (typeof dependencies === 'string') {
allFileDetails.set(url, (0, get_string_details_1.getStringDetails)(url, dependencies));
}
}
}
const transformedManifest = await (0, transform_manifest_1.transformManifest)({
additionalManifestEntries,
dontCacheBustURLsMatching,
manifestTransforms,
maximumFileSizeToCacheInBytes,
modifyURLPrefix,
fileDetails: Array.from(allFileDetails.values()),
});
transformedManifest.warnings.push(...warnings);
return transformedManifest;
}
exports.getFileManifestEntries = getFileManifestEntries;

View file

@ -0,0 +1 @@
export declare function getFileSize(file: string): number | null;

View file

@ -0,0 +1,29 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFileSize = void 0;
const fs_extra_1 = __importDefault(require("fs-extra"));
const errors_1 = require("./errors");
function getFileSize(file) {
try {
const stat = fs_extra_1.default.statSync(file);
if (!stat.isFile()) {
return null;
}
return stat.size;
}
catch (err) {
throw new Error(errors_1.errors['unable-to-get-file-size'] +
` '${err instanceof Error && err.message ? err.message : ''}'`);
}
}
exports.getFileSize = getFileSize;

View file

@ -0,0 +1 @@
export declare function getSourceMapURL(srcContents: string): string | null;

View file

@ -0,0 +1,32 @@
"use strict";
/*
Copyright 2022 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSourceMapURL = void 0;
// Adapted from https://github.com/lydell/source-map-url/blob/master/source-map-url.js
// See https://github.com/GoogleChrome/workbox/issues/3019
const innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/;
const regex = RegExp('(?:' +
'/\\*' +
'(?:\\s*\r?\n(?://)?)?' +
'(?:' +
innerRegex.source +
')' +
'\\s*' +
'\\*/' +
'|' +
'//(?:' +
innerRegex.source +
')' +
')' +
'\\s*');
function getSourceMapURL(srcContents) {
const match = srcContents.match(regex);
return match ? match[1] || match[2] || '' : null;
}
exports.getSourceMapURL = getSourceMapURL;

View file

@ -0,0 +1,2 @@
import { FileDetails } from '../types';
export declare function getStringDetails(url: string, str: string): FileDetails;

View file

@ -0,0 +1,19 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStringDetails = void 0;
const get_string_hash_1 = require("./get-string-hash");
function getStringDetails(url, str) {
return {
file: url,
hash: (0, get_string_hash_1.getStringHash)(str),
size: str.length,
};
}
exports.getStringDetails = getStringDetails;

View file

@ -0,0 +1,3 @@
/// <reference types="node" />
import crypto from 'crypto';
export declare function getStringHash(input: crypto.BinaryLike): string;

View file

@ -0,0 +1,20 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStringHash = void 0;
const crypto_1 = __importDefault(require("crypto"));
function getStringHash(input) {
const md5 = crypto_1.default.createHash('md5');
md5.update(input);
return md5.digest('hex');
}
exports.getStringHash = getStringHash;

View file

@ -0,0 +1,2 @@
import { ManifestTransform } from '../types';
export declare function maximumSizeTransform(maximumFileSizeToCacheInBytes: number): ManifestTransform;

View file

@ -0,0 +1,30 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.maximumSizeTransform = void 0;
const pretty_bytes_1 = __importDefault(require("pretty-bytes"));
function maximumSizeTransform(maximumFileSizeToCacheInBytes) {
return (originalManifest) => {
const warnings = [];
const manifest = originalManifest.filter((entry) => {
if (entry.size <= maximumFileSizeToCacheInBytes) {
return true;
}
warnings.push(`${entry.url} is ${(0, pretty_bytes_1.default)(entry.size)}, and won't ` +
`be precached. Configure maximumFileSizeToCacheInBytes to change ` +
`this limit.`);
return false;
});
return { manifest, warnings };
};
}
exports.maximumSizeTransform = maximumSizeTransform;

View file

@ -0,0 +1,4 @@
import { ManifestTransform } from '../types';
export declare function modifyURLPrefixTransform(modifyURLPrefix: {
[key: string]: string;
}): ManifestTransform;

View file

@ -0,0 +1,51 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.modifyURLPrefixTransform = void 0;
const errors_1 = require("./errors");
const escape_regexp_1 = require("./escape-regexp");
function modifyURLPrefixTransform(modifyURLPrefix) {
if (!modifyURLPrefix ||
typeof modifyURLPrefix !== 'object' ||
Array.isArray(modifyURLPrefix)) {
throw new Error(errors_1.errors['modify-url-prefix-bad-prefixes']);
}
// If there are no entries in modifyURLPrefix, just return an identity
// function as a shortcut.
if (Object.keys(modifyURLPrefix).length === 0) {
return (manifest) => {
return { manifest };
};
}
for (const key of Object.keys(modifyURLPrefix)) {
if (typeof modifyURLPrefix[key] !== 'string') {
throw new Error(errors_1.errors['modify-url-prefix-bad-prefixes']);
}
}
// Escape the user input so it's safe to use in a regex.
const safeModifyURLPrefixes = Object.keys(modifyURLPrefix).map(escape_regexp_1.escapeRegExp);
// Join all the `modifyURLPrefix` keys so a single regex can be used.
const prefixMatchesStrings = safeModifyURLPrefixes.join('|');
// Add `^` to the front the prefix matches so it only matches the start of
// a string.
const modifyRegex = new RegExp(`^(${prefixMatchesStrings})`);
return (originalManifest) => {
const manifest = originalManifest.map((entry) => {
if (typeof entry.url !== 'string') {
throw new Error(errors_1.errors['manifest-entry-bad-url']);
}
entry.url = entry.url.replace(modifyRegex, (match) => {
return modifyURLPrefix[match];
});
return entry;
});
return { manifest };
};
}
exports.modifyURLPrefixTransform = modifyURLPrefixTransform;

View file

@ -0,0 +1,33 @@
/**
* Class for keeping track of which Workbox modules are used by the generated
* service worker script.
*
* @private
*/
export declare class ModuleRegistry {
private readonly _modulesUsed;
/**
* @private
*/
constructor();
/**
* @return {Array<string>} A list of all of the import statements that are
* needed for the modules being used.
* @private
*/
getImportStatements(): Array<string>;
/**
* @param {string} pkg The workbox package that the module belongs to.
* @param {string} moduleName The name of the module to import.
* @return {string} The local variable name that corresponds to that module.
* @private
*/
getLocalName(pkg: string, moduleName: string): string;
/**
* @param {string} pkg The workbox package that the module belongs to.
* @param {string} moduleName The name of the module to import.
* @return {string} The local variable name that corresponds to that module.
* @private
*/
use(pkg: string, moduleName: string): string;
}

View file

@ -0,0 +1,70 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModuleRegistry = void 0;
const common_tags_1 = require("common-tags");
const upath_1 = __importDefault(require("upath"));
/**
* Class for keeping track of which Workbox modules are used by the generated
* service worker script.
*
* @private
*/
class ModuleRegistry {
/**
* @private
*/
constructor() {
this._modulesUsed = new Map();
}
/**
* @return {Array<string>} A list of all of the import statements that are
* needed for the modules being used.
* @private
*/
getImportStatements() {
const workboxModuleImports = [];
for (const [localName, { moduleName, pkg }] of this._modulesUsed) {
// By default require.resolve returns the resolved path of the 'main'
// field, which might be deeper than the package root. To work around
// this, we can find the package's root by resolving its package.json and
// strip the '/package.json' from the resolved path.
const pkgJsonPath = require.resolve(`${pkg}/package.json`);
const pkgRoot = upath_1.default.dirname(pkgJsonPath);
const importStatement = (0, common_tags_1.oneLine) `import {${moduleName} as ${localName}} from
'${pkgRoot}/${moduleName}.mjs';`;
workboxModuleImports.push(importStatement);
}
return workboxModuleImports;
}
/**
* @param {string} pkg The workbox package that the module belongs to.
* @param {string} moduleName The name of the module to import.
* @return {string} The local variable name that corresponds to that module.
* @private
*/
getLocalName(pkg, moduleName) {
return `${pkg.replace(/-/g, '_')}_${moduleName}`;
}
/**
* @param {string} pkg The workbox package that the module belongs to.
* @param {string} moduleName The name of the module to import.
* @return {string} The local variable name that corresponds to that module.
* @private
*/
use(pkg, moduleName) {
const localName = this.getLocalName(pkg, moduleName);
this._modulesUsed.set(localName, { moduleName, pkg });
return localName;
}
}
exports.ModuleRegistry = ModuleRegistry;

View file

@ -0,0 +1,2 @@
import { ManifestTransform } from '../types';
export declare function noRevisionForURLsMatchingTransform(regexp: RegExp): ManifestTransform;

View file

@ -0,0 +1,29 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.noRevisionForURLsMatchingTransform = void 0;
const errors_1 = require("./errors");
function noRevisionForURLsMatchingTransform(regexp) {
if (!(regexp instanceof RegExp)) {
throw new Error(errors_1.errors['invalid-dont-cache-bust']);
}
return (originalManifest) => {
const manifest = originalManifest.map((entry) => {
if (typeof entry.url !== 'string') {
throw new Error(errors_1.errors['manifest-entry-bad-url']);
}
if (entry.url.match(regexp)) {
entry.revision = null;
}
return entry;
});
return { manifest };
};
}
exports.noRevisionForURLsMatchingTransform = noRevisionForURLsMatchingTransform;

View file

@ -0,0 +1,4 @@
import { GeneratePartial, ManifestEntry } from '../types';
export declare function populateSWTemplate({ cacheId, cleanupOutdatedCaches, clientsClaim, directoryIndex, disableDevLogs, ignoreURLParametersMatching, importScripts, manifestEntries, navigateFallback, navigateFallbackDenylist, navigateFallbackAllowlist, navigationPreload, offlineGoogleAnalytics, runtimeCaching, skipWaiting, }: GeneratePartial & {
manifestEntries?: Array<ManifestEntry>;
}): string;

View file

@ -0,0 +1,79 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.populateSWTemplate = void 0;
const template_1 = __importDefault(require("lodash/template"));
const errors_1 = require("./errors");
const module_registry_1 = require("./module-registry");
const runtime_caching_converter_1 = require("./runtime-caching-converter");
const stringify_without_comments_1 = require("./stringify-without-comments");
const sw_template_1 = require("../templates/sw-template");
function populateSWTemplate({ cacheId, cleanupOutdatedCaches, clientsClaim, directoryIndex, disableDevLogs, ignoreURLParametersMatching, importScripts, manifestEntries = [], navigateFallback, navigateFallbackDenylist, navigateFallbackAllowlist, navigationPreload, offlineGoogleAnalytics, runtimeCaching = [], skipWaiting, }) {
// There needs to be at least something to precache, or else runtime caching.
if (!((manifestEntries === null || manifestEntries === void 0 ? void 0 : manifestEntries.length) > 0 || runtimeCaching.length > 0)) {
throw new Error(errors_1.errors['no-manifest-entries-or-runtime-caching']);
}
// These are all options that can be passed to the precacheAndRoute() method.
const precacheOptions = {
directoryIndex,
// An array of RegExp objects can't be serialized by JSON.stringify()'s
// default behavior, so if it's given, convert it manually.
ignoreURLParametersMatching: ignoreURLParametersMatching
? []
: undefined,
};
let precacheOptionsString = JSON.stringify(precacheOptions, null, 2);
if (ignoreURLParametersMatching) {
precacheOptionsString = precacheOptionsString.replace(`"ignoreURLParametersMatching": []`, `"ignoreURLParametersMatching": [` +
`${ignoreURLParametersMatching.join(', ')}]`);
}
let offlineAnalyticsConfigString = undefined;
if (offlineGoogleAnalytics) {
// If offlineGoogleAnalytics is a truthy value, we need to convert it to the
// format expected by the template.
offlineAnalyticsConfigString =
offlineGoogleAnalytics === true
? // If it's the literal value true, then use an empty config string.
'{}'
: // Otherwise, convert the config object into a more complex string, taking
// into account the fact that functions might need to be stringified.
(0, stringify_without_comments_1.stringifyWithoutComments)(offlineGoogleAnalytics);
}
const moduleRegistry = new module_registry_1.ModuleRegistry();
try {
const populatedTemplate = (0, template_1.default)(sw_template_1.swTemplate)({
cacheId,
cleanupOutdatedCaches,
clientsClaim,
disableDevLogs,
importScripts,
manifestEntries,
navigateFallback,
navigateFallbackDenylist,
navigateFallbackAllowlist,
navigationPreload,
offlineAnalyticsConfigString,
precacheOptionsString,
runtimeCaching: (0, runtime_caching_converter_1.runtimeCachingConverter)(moduleRegistry, runtimeCaching),
skipWaiting,
use: moduleRegistry.use.bind(moduleRegistry),
});
const workboxImportStatements = moduleRegistry.getImportStatements();
// We need the import statements for all of the Workbox runtime modules
// prepended, so that the correct bundle can be created.
return workboxImportStatements.join('\n') + populatedTemplate;
}
catch (error) {
throw new Error(`${errors_1.errors['populating-sw-tmpl-failed']} '${error instanceof Error && error.message ? error.message : ''}'`);
}
}
exports.populateSWTemplate = populateSWTemplate;

View file

@ -0,0 +1,4 @@
export declare function rebasePath({ baseDirectory, file, }: {
baseDirectory: string;
file: string;
}): string;

View file

@ -0,0 +1,24 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.rebasePath = void 0;
const upath_1 = __importDefault(require("upath"));
function rebasePath({ baseDirectory, file, }) {
// The initial path is relative to the current directory, so make it absolute.
const absolutePath = upath_1.default.resolve(file);
// Convert the absolute path so that it's relative to the baseDirectory.
const relativePath = upath_1.default.relative(baseDirectory, absolutePath);
// Remove any leading ./ as it won't work in a glob pattern.
const normalizedPath = upath_1.default.normalize(relativePath);
return normalizedPath;
}
exports.rebasePath = rebasePath;

View file

@ -0,0 +1,30 @@
import { RawSourceMap } from 'source-map';
/**
* Adapted from https://github.com/nsams/sourcemap-aware-replace, with modern
* JavaScript updates, along with additional properties copied from originalMap.
*
* @param {Object} options
* @param {string} options.jsFilename The name for the file whose contents
* correspond to originalSource.
* @param {Object} options.originalMap The sourcemap for originalSource,
* prior to any replacements.
* @param {string} options.originalSource The source code, prior to any
* replacements.
* @param {string} options.replaceString A string to swap in for searchString.
* @param {string} options.searchString A string in originalSource to replace.
* Only the first occurrence will be replaced.
* @return {{source: string, map: string}} An object containing both
* originalSource with the replacement applied, and the modified originalMap.
*
* @private
*/
export declare function replaceAndUpdateSourceMap({ jsFilename, originalMap, originalSource, replaceString, searchString, }: {
jsFilename: string;
originalMap: RawSourceMap;
originalSource: string;
replaceString: string;
searchString: string;
}): Promise<{
map: string;
source: string;
}>;

View file

@ -0,0 +1,98 @@
"use strict";
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.replaceAndUpdateSourceMap = void 0;
const source_map_1 = require("source-map");
/**
* Adapted from https://github.com/nsams/sourcemap-aware-replace, with modern
* JavaScript updates, along with additional properties copied from originalMap.
*
* @param {Object} options
* @param {string} options.jsFilename The name for the file whose contents
* correspond to originalSource.
* @param {Object} options.originalMap The sourcemap for originalSource,
* prior to any replacements.
* @param {string} options.originalSource The source code, prior to any
* replacements.
* @param {string} options.replaceString A string to swap in for searchString.
* @param {string} options.searchString A string in originalSource to replace.
* Only the first occurrence will be replaced.
* @return {{source: string, map: string}} An object containing both
* originalSource with the replacement applied, and the modified originalMap.
*
* @private
*/
async function replaceAndUpdateSourceMap({ jsFilename, originalMap, originalSource, replaceString, searchString, }) {
const generator = new source_map_1.SourceMapGenerator({
file: jsFilename,
});
const consumer = await new source_map_1.SourceMapConsumer(originalMap);
let pos;
let src = originalSource;
const replacements = [];
let lineNum = 0;
let filePos = 0;
const lines = src.split('\n');
for (let line of lines) {
lineNum++;
let searchPos = 0;
while ((pos = line.indexOf(searchString, searchPos)) !== -1) {
src =
src.substring(0, filePos + pos) +
replaceString +
src.substring(filePos + pos + searchString.length);
line =
line.substring(0, pos) +
replaceString +
line.substring(pos + searchString.length);
replacements.push({ line: lineNum, column: pos });
searchPos = pos + replaceString.length;
}
filePos += line.length + 1;
}
replacements.reverse();
consumer.eachMapping((mapping) => {
for (const replacement of replacements) {
if (replacement.line === mapping.generatedLine &&
mapping.generatedColumn > replacement.column) {
const offset = searchString.length - replaceString.length;
mapping.generatedColumn -= offset;
}
}
if (mapping.source) {
const newMapping = {
generated: {
line: mapping.generatedLine,
column: mapping.generatedColumn,
},
original: {
line: mapping.originalLine,
column: mapping.originalColumn,
},
source: mapping.source,
};
return generator.addMapping(newMapping);
}
return mapping;
});
consumer.destroy();
// JSON.parse returns any.
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const updatedSourceMap = Object.assign(JSON.parse(generator.toString()), {
names: originalMap.names,
sourceRoot: originalMap.sourceRoot,
sources: originalMap.sources,
sourcesContent: originalMap.sourcesContent,
});
return {
map: JSON.stringify(updatedSourceMap),
source: src,
};
}
exports.replaceAndUpdateSourceMap = replaceAndUpdateSourceMap;

View file

@ -0,0 +1,3 @@
import { ModuleRegistry } from './module-registry';
import { RuntimeCaching } from '../types';
export declare function runtimeCachingConverter(moduleRegistry: ModuleRegistry, runtimeCaching: Array<RuntimeCaching>): Array<string>;

View file

@ -0,0 +1,142 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.runtimeCachingConverter = void 0;
const common_tags_1 = require("common-tags");
const errors_1 = require("./errors");
const stringify_without_comments_1 = require("./stringify-without-comments");
/**
* Given a set of options that configures runtime caching behavior, convert it
* to the equivalent Workbox method calls.
*
* @param {ModuleRegistry} moduleRegistry
* @param {Object} options See
* https://developers.google.com/web/tools/workbox/modules/workbox-build#generateSW-runtimeCaching
* @return {string} A JSON string representing the equivalent options.
*
* @private
*/
function getOptionsString(moduleRegistry, options = {}) {
const plugins = [];
const handlerOptions = {};
for (const optionName of Object.keys(options)) {
if (options[optionName] === undefined) {
continue;
}
switch (optionName) {
// Using a library here because JSON.stringify won't handle functions.
case 'plugins': {
plugins.push(...options.plugins.map(stringify_without_comments_1.stringifyWithoutComments));
break;
}
// These are the option properties that we want to pull out, so that
// they're passed to the handler constructor.
case 'cacheName':
case 'networkTimeoutSeconds':
case 'fetchOptions':
case 'matchOptions': {
handlerOptions[optionName] = options[optionName];
break;
}
// The following cases are all shorthands for creating a plugin with a
// given configuration.
case 'backgroundSync': {
const name = options.backgroundSync.name;
const plugin = moduleRegistry.use('workbox-background-sync', 'BackgroundSyncPlugin');
let pluginCode = `new ${plugin}(${JSON.stringify(name)}`;
if (options.backgroundSync.options) {
pluginCode += `, ${(0, stringify_without_comments_1.stringifyWithoutComments)(options.backgroundSync.options)}`;
}
pluginCode += `)`;
plugins.push(pluginCode);
break;
}
case 'broadcastUpdate': {
const channelName = options.broadcastUpdate.channelName;
const opts = Object.assign({ channelName }, options.broadcastUpdate.options);
const plugin = moduleRegistry.use('workbox-broadcast-update', 'BroadcastUpdatePlugin');
plugins.push(`new ${plugin}(${(0, stringify_without_comments_1.stringifyWithoutComments)(opts)})`);
break;
}
case 'cacheableResponse': {
const plugin = moduleRegistry.use('workbox-cacheable-response', 'CacheableResponsePlugin');
plugins.push(`new ${plugin}(${(0, stringify_without_comments_1.stringifyWithoutComments)(options.cacheableResponse)})`);
break;
}
case 'expiration': {
const plugin = moduleRegistry.use('workbox-expiration', 'ExpirationPlugin');
plugins.push(`new ${plugin}(${(0, stringify_without_comments_1.stringifyWithoutComments)(options.expiration)})`);
break;
}
case 'precacheFallback': {
const plugin = moduleRegistry.use('workbox-precaching', 'PrecacheFallbackPlugin');
plugins.push(`new ${plugin}(${(0, stringify_without_comments_1.stringifyWithoutComments)(options.precacheFallback)})`);
break;
}
case 'rangeRequests': {
const plugin = moduleRegistry.use('workbox-range-requests', 'RangeRequestsPlugin');
// There are no configuration options for the constructor.
plugins.push(`new ${plugin}()`);
break;
}
default: {
throw new Error(
// In the default case optionName is typed as 'never'.
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
`${errors_1.errors['bad-runtime-caching-config']} ${optionName}`);
}
}
}
if (Object.keys(handlerOptions).length > 0 || plugins.length > 0) {
const optionsString = JSON.stringify(handlerOptions).slice(1, -1);
return (0, common_tags_1.oneLine) `{
${optionsString ? optionsString + ',' : ''}
plugins: [${plugins.join(', ')}]
}`;
}
else {
return '';
}
}
function runtimeCachingConverter(moduleRegistry, runtimeCaching) {
return runtimeCaching
.map((entry) => {
const method = entry.method || 'GET';
if (!entry.urlPattern) {
throw new Error(errors_1.errors['urlPattern-is-required']);
}
if (!entry.handler) {
throw new Error(errors_1.errors['handler-is-required']);
}
if (entry.options &&
entry.options.networkTimeoutSeconds &&
entry.handler !== 'NetworkFirst') {
throw new Error(errors_1.errors['invalid-network-timeout-seconds']);
}
// urlPattern might be a string, a RegExp object, or a function.
// If it's a string, it needs to be quoted.
const matcher = typeof entry.urlPattern === 'string'
? JSON.stringify(entry.urlPattern)
: entry.urlPattern;
const registerRoute = moduleRegistry.use('workbox-routing', 'registerRoute');
if (typeof entry.handler === 'string') {
const optionsString = getOptionsString(moduleRegistry, entry.options);
const handler = moduleRegistry.use('workbox-strategies', entry.handler);
const strategyString = `new ${handler}(${optionsString})`;
return `${registerRoute}(${matcher.toString()}, ${strategyString}, '${method}');\n`;
}
else if (typeof entry.handler === 'function') {
return `${registerRoute}(${matcher.toString()}, ${entry.handler.toString()}, '${method}');\n`;
}
// '' will be filtered out.
return '';
})
.filter((entry) => Boolean(entry));
}
exports.runtimeCachingConverter = runtimeCachingConverter;

View file

@ -0,0 +1,3 @@
export declare function stringifyWithoutComments(obj: {
[key: string]: any;
}): string;

View file

@ -0,0 +1,28 @@
"use strict";
/*
Copyright 2021 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringifyWithoutComments = void 0;
const stringify_object_1 = __importDefault(require("stringify-object"));
const strip_comments_1 = __importDefault(require("strip-comments"));
function stringifyWithoutComments(obj) {
return (0, stringify_object_1.default)(obj, {
// See https://github.com/yeoman/stringify-object#transformobject-property-originalresult
transform: (_obj, _prop, str) => {
if (typeof _prop !== 'symbol' && typeof _obj[_prop] === 'function') {
// Can't typify correctly stripComments
return (0, strip_comments_1.default)(str); // eslint-disable-line
}
return str;
},
});
}
exports.stringifyWithoutComments = stringifyWithoutComments;

View file

@ -0,0 +1,63 @@
import { BasePartial, FileDetails, ManifestEntry } from '../types';
/**
* A `ManifestTransform` function can be used to modify the modify the `url` or
* `revision` properties of some or all of the
* {@link workbox-build.ManifestEntry} in the manifest.
*
* Deleting the `revision` property of an entry will cause
* the corresponding `url` to be precached without cache-busting parameters
* applied, which is to say, it implies that the URL itself contains
* proper versioning info. If the `revision` property is present, it must be
* set to a string.
*
* @example A transformation that prepended the origin of a CDN for any
* URL starting with '/assets/' could be implemented as:
*
* const cdnTransform = async (manifestEntries) => {
* const manifest = manifestEntries.map(entry => {
* const cdnOrigin = 'https://example.com';
* if (entry.url.startsWith('/assets/')) {
* entry.url = cdnOrigin + entry.url;
* }
* return entry;
* });
* return {manifest, warnings: []};
* };
*
* @example A transformation that nulls the revision field when the
* URL contains an 8-character hash surrounded by '.', indicating that it
* already contains revision information:
*
* const removeRevisionTransform = async (manifestEntries) => {
* const manifest = manifestEntries.map(entry => {
* const hashRegExp = /\.\w{8}\./;
* if (entry.url.match(hashRegExp)) {
* entry.revision = null;
* }
* return entry;
* });
* return {manifest, warnings: []};
* };
*
* @callback ManifestTransform
* @param {Array<workbox-build.ManifestEntry>} manifestEntries The full
* array of entries, prior to the current transformation.
* @param {Object} [compilation] When used in the webpack plugins, this param
* will be set to the current `compilation`.
* @return {Promise<workbox-build.ManifestTransformResult>}
* The array of entries with the transformation applied, and optionally, any
* warnings that should be reported back to the build tool.
*
* @memberof workbox-build
*/
interface ManifestTransformResultWithWarnings {
count: number;
size: number;
manifestEntries: ManifestEntry[];
warnings: string[];
}
export declare function transformManifest({ additionalManifestEntries, dontCacheBustURLsMatching, fileDetails, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, transformParam, }: BasePartial & {
fileDetails: Array<FileDetails>;
transformParam?: unknown;
}): Promise<ManifestTransformResultWithWarnings>;
export {};

View file

@ -0,0 +1,69 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.transformManifest = void 0;
const additional_manifest_entries_transform_1 = require("./additional-manifest-entries-transform");
const errors_1 = require("./errors");
const maximum_size_transform_1 = require("./maximum-size-transform");
const modify_url_prefix_transform_1 = require("./modify-url-prefix-transform");
const no_revision_for_urls_matching_transform_1 = require("./no-revision-for-urls-matching-transform");
async function transformManifest({ additionalManifestEntries, dontCacheBustURLsMatching, fileDetails, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, transformParam, }) {
const allWarnings = [];
// Take the array of fileDetail objects and convert it into an array of
// {url, revision, size} objects, with \ replaced with /.
const normalizedManifest = fileDetails.map((fileDetails) => {
return {
url: fileDetails.file.replace(/\\/g, '/'),
revision: fileDetails.hash,
size: fileDetails.size,
};
});
const transformsToApply = [];
if (maximumFileSizeToCacheInBytes) {
transformsToApply.push((0, maximum_size_transform_1.maximumSizeTransform)(maximumFileSizeToCacheInBytes));
}
if (modifyURLPrefix) {
transformsToApply.push((0, modify_url_prefix_transform_1.modifyURLPrefixTransform)(modifyURLPrefix));
}
if (dontCacheBustURLsMatching) {
transformsToApply.push((0, no_revision_for_urls_matching_transform_1.noRevisionForURLsMatchingTransform)(dontCacheBustURLsMatching));
}
// Run any manifestTransforms functions second-to-last.
if (manifestTransforms) {
transformsToApply.push(...manifestTransforms);
}
// Run additionalManifestEntriesTransform last.
if (additionalManifestEntries) {
transformsToApply.push((0, additional_manifest_entries_transform_1.additionalManifestEntriesTransform)(additionalManifestEntries));
}
let transformedManifest = normalizedManifest;
for (const transform of transformsToApply) {
const result = await transform(transformedManifest, transformParam);
if (!('manifest' in result)) {
throw new Error(errors_1.errors['bad-manifest-transforms-return-value']);
}
transformedManifest = result.manifest;
allWarnings.push(...(result.warnings || []));
}
// Generate some metadata about the manifest before we clear out the size
// properties from each entry.
const count = transformedManifest.length;
let size = 0;
for (const manifestEntry of transformedManifest) {
size += manifestEntry.size || 0;
delete manifestEntry.size;
}
return {
count,
size,
manifestEntries: transformedManifest,
warnings: allWarnings,
};
}
exports.transformManifest = transformManifest;

View file

@ -0,0 +1,5 @@
export declare function translateURLToSourcemapPaths(url: string | null, swSrc: string, swDest: string): {
destPath: string | undefined;
srcPath: string | undefined;
warning: string | undefined;
};

View file

@ -0,0 +1,33 @@
"use strict";
/*
Copyright 2021 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.translateURLToSourcemapPaths = void 0;
const fs_extra_1 = __importDefault(require("fs-extra"));
const upath_1 = __importDefault(require("upath"));
const errors_1 = require("./errors");
function translateURLToSourcemapPaths(url, swSrc, swDest) {
let destPath = undefined;
let srcPath = undefined;
let warning = undefined;
if (url && !url.startsWith('data:')) {
const possibleSrcPath = upath_1.default.resolve(upath_1.default.dirname(swSrc), url);
if (fs_extra_1.default.existsSync(possibleSrcPath)) {
srcPath = possibleSrcPath;
destPath = upath_1.default.resolve(upath_1.default.dirname(swDest), url);
}
else {
warning = `${errors_1.errors['cant-find-sourcemap']} ${possibleSrcPath}`;
}
}
return { destPath, srcPath, warning };
}
exports.translateURLToSourcemapPaths = translateURLToSourcemapPaths;

View file

@ -0,0 +1,9 @@
import { GenerateSWOptions, GetManifestOptions, InjectManifestOptions, WebpackGenerateSWOptions, WebpackInjectManifestOptions } from '../types';
export declare class WorkboxConfigError extends Error {
constructor(message?: string);
}
export declare function validateGenerateSWOptions(input: unknown): GenerateSWOptions;
export declare function validateGetManifestOptions(input: unknown): GetManifestOptions;
export declare function validateInjectManifestOptions(input: unknown): InjectManifestOptions;
export declare function validateWebpackGenerateSWOptions(input: unknown): WebpackGenerateSWOptions;
export declare function validateWebpackInjectManifestOptions(input: unknown): WebpackInjectManifestOptions;

View file

@ -0,0 +1,147 @@
"use strict";
/*
Copyright 2021 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateWebpackInjectManifestOptions = exports.validateWebpackGenerateSWOptions = exports.validateInjectManifestOptions = exports.validateGetManifestOptions = exports.validateGenerateSWOptions = exports.WorkboxConfigError = void 0;
const better_ajv_errors_1 = require("@apideck/better-ajv-errors");
const common_tags_1 = require("common-tags");
const ajv_1 = __importDefault(require("ajv"));
const errors_1 = require("./errors");
const ajv = new ajv_1.default({
useDefaults: true,
});
const DEFAULT_EXCLUDE_VALUE = [/\.map$/, /^manifest.*\.js$/];
class WorkboxConfigError extends Error {
constructor(message) {
super(message);
Object.setPrototypeOf(this, new.target.prototype);
}
}
exports.WorkboxConfigError = WorkboxConfigError;
// Some methods need to do follow-up validation using the JSON schema,
// so return both the validated options and then schema.
function validate(input, methodName) {
// Don't mutate input: https://github.com/GoogleChrome/workbox/issues/2158
const inputCopy = Object.assign({}, input);
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const jsonSchema = require(`../schema/${methodName}Options.json`);
const validate = ajv.compile(jsonSchema);
if (validate(inputCopy)) {
// All methods support manifestTransforms, so validate it here.
ensureValidManifestTransforms(inputCopy);
return [inputCopy, jsonSchema];
}
const betterErrors = (0, better_ajv_errors_1.betterAjvErrors)({
basePath: methodName,
data: input,
errors: validate.errors,
// This is needed as JSONSchema6 is expected, but JSONSchemaType works.
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
schema: jsonSchema,
});
const messages = betterErrors.map((err) => (0, common_tags_1.oneLine) `[${err.path}] ${err.message}.
${err.suggestion ? err.suggestion : ''}`);
throw new WorkboxConfigError(messages.join('\n\n'));
}
function ensureValidManifestTransforms(options) {
if ('manifestTransforms' in options &&
!(Array.isArray(options.manifestTransforms) &&
options.manifestTransforms.every((item) => typeof item === 'function'))) {
throw new WorkboxConfigError(errors_1.errors['manifest-transforms']);
}
}
function ensureValidNavigationPreloadConfig(options) {
if (options.navigationPreload &&
(!Array.isArray(options.runtimeCaching) ||
options.runtimeCaching.length === 0)) {
throw new WorkboxConfigError(errors_1.errors['nav-preload-runtime-caching']);
}
}
function ensureValidCacheExpiration(options) {
var _a, _b;
for (const runtimeCaching of options.runtimeCaching || []) {
if (((_a = runtimeCaching.options) === null || _a === void 0 ? void 0 : _a.expiration) &&
!((_b = runtimeCaching.options) === null || _b === void 0 ? void 0 : _b.cacheName)) {
throw new WorkboxConfigError(errors_1.errors['cache-name-required']);
}
}
}
function ensureValidRuntimeCachingOrGlobDirectory(options) {
if (!options.globDirectory &&
(!Array.isArray(options.runtimeCaching) ||
options.runtimeCaching.length === 0)) {
throw new WorkboxConfigError(errors_1.errors['no-manifest-entries-or-runtime-caching']);
}
}
// This is... messy, because we can't rely on the built-in ajv validation for
// runtimeCaching.handler, as it needs to accept {} (i.e. any) due to
// https://github.com/GoogleChrome/workbox/pull/2899
// So we need to perform validation when a string (not a function) is used.
function ensureValidStringHandler(options, jsonSchema) {
var _a, _b, _c, _d;
let validHandlers = [];
/* eslint-disable */
for (const handler of ((_d = (_c = (_b = (_a = jsonSchema.definitions) === null || _a === void 0 ? void 0 : _a.RuntimeCaching) === null || _b === void 0 ? void 0 : _b.properties) === null || _c === void 0 ? void 0 : _c.handler) === null || _d === void 0 ? void 0 : _d.anyOf) || []) {
if ('enum' in handler) {
validHandlers = handler.enum;
break;
}
}
/* eslint-enable */
for (const runtimeCaching of options.runtimeCaching || []) {
if (typeof runtimeCaching.handler === 'string' &&
!validHandlers.includes(runtimeCaching.handler)) {
throw new WorkboxConfigError(errors_1.errors['invalid-handler-string'] + runtimeCaching.handler);
}
}
}
function validateGenerateSWOptions(input) {
const [validatedOptions, jsonSchema] = validate(input, 'GenerateSW');
ensureValidNavigationPreloadConfig(validatedOptions);
ensureValidCacheExpiration(validatedOptions);
ensureValidRuntimeCachingOrGlobDirectory(validatedOptions);
ensureValidStringHandler(validatedOptions, jsonSchema);
return validatedOptions;
}
exports.validateGenerateSWOptions = validateGenerateSWOptions;
function validateGetManifestOptions(input) {
const [validatedOptions] = validate(input, 'GetManifest');
return validatedOptions;
}
exports.validateGetManifestOptions = validateGetManifestOptions;
function validateInjectManifestOptions(input) {
const [validatedOptions] = validate(input, 'InjectManifest');
return validatedOptions;
}
exports.validateInjectManifestOptions = validateInjectManifestOptions;
// The default `exclude: [/\.map$/, /^manifest.*\.js$/]` value can't be
// represented in the JSON schema, so manually set it for the webpack options.
function validateWebpackGenerateSWOptions(input) {
const inputWithExcludeDefault = Object.assign({
// Make a copy, as exclude can be mutated when used.
exclude: Array.from(DEFAULT_EXCLUDE_VALUE),
}, input);
const [validatedOptions, jsonSchema] = validate(inputWithExcludeDefault, 'WebpackGenerateSW');
ensureValidNavigationPreloadConfig(validatedOptions);
ensureValidCacheExpiration(validatedOptions);
ensureValidStringHandler(validatedOptions, jsonSchema);
return validatedOptions;
}
exports.validateWebpackGenerateSWOptions = validateWebpackGenerateSWOptions;
function validateWebpackInjectManifestOptions(input) {
const inputWithExcludeDefault = Object.assign({
// Make a copy, as exclude can be mutated when used.
exclude: Array.from(DEFAULT_EXCLUDE_VALUE),
}, input);
const [validatedOptions] = validate(inputWithExcludeDefault, 'WebpackInjectManifest');
return validatedOptions;
}
exports.validateWebpackInjectManifestOptions = validateWebpackInjectManifestOptions;

View file

@ -0,0 +1,4 @@
import { GenerateSWOptions, ManifestEntry } from '../types';
export declare function writeSWUsingDefaultTemplate({ babelPresetEnvTargets, cacheId, cleanupOutdatedCaches, clientsClaim, directoryIndex, disableDevLogs, ignoreURLParametersMatching, importScripts, inlineWorkboxRuntime, manifestEntries, mode, navigateFallback, navigateFallbackDenylist, navigateFallbackAllowlist, navigationPreload, offlineGoogleAnalytics, runtimeCaching, skipWaiting, sourcemap, swDest, }: GenerateSWOptions & {
manifestEntries: Array<ManifestEntry>;
}): Promise<Array<string>>;

View file

@ -0,0 +1,71 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.writeSWUsingDefaultTemplate = void 0;
const fs_extra_1 = __importDefault(require("fs-extra"));
const upath_1 = __importDefault(require("upath"));
const bundle_1 = require("./bundle");
const errors_1 = require("./errors");
const populate_sw_template_1 = require("./populate-sw-template");
async function writeSWUsingDefaultTemplate({ babelPresetEnvTargets, cacheId, cleanupOutdatedCaches, clientsClaim, directoryIndex, disableDevLogs, ignoreURLParametersMatching, importScripts, inlineWorkboxRuntime, manifestEntries, mode, navigateFallback, navigateFallbackDenylist, navigateFallbackAllowlist, navigationPreload, offlineGoogleAnalytics, runtimeCaching, skipWaiting, sourcemap, swDest, }) {
const outputDir = upath_1.default.dirname(swDest);
try {
await fs_extra_1.default.mkdirp(outputDir);
}
catch (error) {
throw new Error(`${errors_1.errors['unable-to-make-sw-directory']}. ` +
`'${error instanceof Error && error.message ? error.message : ''}'`);
}
const unbundledCode = (0, populate_sw_template_1.populateSWTemplate)({
cacheId,
cleanupOutdatedCaches,
clientsClaim,
directoryIndex,
disableDevLogs,
ignoreURLParametersMatching,
importScripts,
manifestEntries,
navigateFallback,
navigateFallbackDenylist,
navigateFallbackAllowlist,
navigationPreload,
offlineGoogleAnalytics,
runtimeCaching,
skipWaiting,
});
try {
const files = await (0, bundle_1.bundle)({
babelPresetEnvTargets,
inlineWorkboxRuntime,
mode,
sourcemap,
swDest,
unbundledCode,
});
const filePaths = [];
for (const file of files) {
const filePath = upath_1.default.resolve(file.name);
filePaths.push(filePath);
await fs_extra_1.default.writeFile(filePath, file.contents);
}
return filePaths;
}
catch (error) {
const err = error;
if (err.code === 'EISDIR') {
// See https://github.com/GoogleChrome/workbox/issues/612
throw new Error(errors_1.errors['sw-write-failure-directory']);
}
throw new Error(`${errors_1.errors['sw-write-failure']} '${err.message}'`);
}
}
exports.writeSWUsingDefaultTemplate = writeSWUsingDefaultTemplate;

View file

@ -0,0 +1,878 @@
{
"additionalProperties": false,
"type": "object",
"properties": {
"additionalManifestEntries": {
"description": "A list of entries to be precached, in addition to any entries that are\ngenerated as part of the build configuration.",
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/definitions/ManifestEntry"
},
{
"type": "string"
}
]
}
},
"dontCacheBustURLsMatching": {
"description": "Assets that match this will be assumed to be uniquely versioned via their\nURL, and exempted from the normal HTTP cache-busting that's done when\npopulating the precache. While not required, it's recommended that if your\nexisting build process already inserts a `[hash]` value into each filename,\nyou provide a RegExp that will detect that, as it will reduce the bandwidth\nconsumed when precaching.",
"$ref": "#/definitions/RegExp"
},
"manifestTransforms": {
"description": "One or more functions which will be applied sequentially against the\ngenerated manifest. If `modifyURLPrefix` or `dontCacheBustURLsMatching` are\nalso specified, their corresponding transformations will be applied first.",
"type": "array",
"items": {}
},
"maximumFileSizeToCacheInBytes": {
"description": "This value can be used to determine the maximum size of files that will be\nprecached. This prevents you from inadvertently precaching very large files\nthat might have accidentally matched one of your patterns.",
"default": 2097152,
"type": "number"
},
"modifyURLPrefix": {
"description": "An object mapping string prefixes to replacement string values. This can be\nused to, e.g., remove or add a path prefix from a manifest entry if your\nweb hosting setup doesn't match your local filesystem setup. As an\nalternative with more flexibility, you can use the `manifestTransforms`\noption and provide a function that modifies the entries in the manifest\nusing whatever logic you provide.\n\nExample usage:\n\n```\n// Replace a '/dist/' prefix with '/', and also prepend\n// '/static' to every URL.\nmodifyURLPrefix: {\n '/dist/': '/',\n '': '/static',\n}\n```",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"globFollow": {
"description": "Determines whether or not symlinks are followed when generating the\nprecache manifest. For more information, see the definition of `follow` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).",
"default": true,
"type": "boolean"
},
"globIgnores": {
"description": "A set of patterns matching files to always exclude when generating the\nprecache manifest. For more information, see the definition of `ignore` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).",
"default": [
"**/node_modules/**/*"
],
"type": "array",
"items": {
"type": "string"
}
},
"globPatterns": {
"description": "Files matching any of these patterns will be included in the precache\nmanifest. For more information, see the\n[`glob` primer](https://github.com/isaacs/node-glob#glob-primer).",
"default": [
"**/*.{js,wasm,css,html}"
],
"type": "array",
"items": {
"type": "string"
}
},
"templatedURLs": {
"description": "If a URL is rendered based on some server-side logic, its contents may\ndepend on multiple files or on some other unique string value. The keys in\nthis object are server-rendered URLs. If the values are an array of\nstrings, they will be interpreted as `glob` patterns, and the contents of\nany files matching the patterns will be used to uniquely version the URL.\nIf used with a single string, it will be interpreted as unique versioning\ninformation that you've generated for a given URL.",
"type": "object",
"additionalProperties": {
"anyOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "string"
}
]
}
},
"babelPresetEnvTargets": {
"description": "The [targets](https://babeljs.io/docs/en/babel-preset-env#targets) to pass\nto `babel-preset-env` when transpiling the service worker bundle.",
"default": [
"chrome >= 56"
],
"type": "array",
"items": {
"type": "string"
}
},
"cacheId": {
"description": "An optional ID to be prepended to cache names. This is primarily useful for\nlocal development where multiple sites may be served from the same\n`http://localhost:port` origin.",
"type": [
"null",
"string"
]
},
"cleanupOutdatedCaches": {
"description": "Whether or not Workbox should attempt to identify and delete any precaches\ncreated by older, incompatible versions.",
"default": false,
"type": "boolean"
},
"clientsClaim": {
"description": "Whether or not the service worker should [start controlling](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#clientsclaim)\nany existing clients as soon as it activates.",
"default": false,
"type": "boolean"
},
"directoryIndex": {
"description": "If a navigation request for a URL ending in `/` fails to match a precached\nURL, this value will be appended to the URL and that will be checked for a\nprecache match. This should be set to what your web server is using for its\ndirectory index.",
"type": [
"null",
"string"
]
},
"disableDevLogs": {
"default": false,
"type": "boolean"
},
"ignoreURLParametersMatching": {
"description": "Any search parameter names that match against one of the RegExp in this\narray will be removed before looking for a precache match. This is useful\nif your users might request URLs that contain, for example, URL parameters\nused to track the source of the traffic. If not provided, the default value\nis `[/^utm_/, /^fbclid$/]`.",
"type": "array",
"items": {
"$ref": "#/definitions/RegExp"
}
},
"importScripts": {
"description": "A list of JavaScript files that should be passed to\n[`importScripts()`](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts)\ninside the generated service worker file. This is useful when you want to\nlet Workbox create your top-level service worker file, but want to include\nsome additional code, such as a push event listener.",
"type": "array",
"items": {
"type": "string"
}
},
"inlineWorkboxRuntime": {
"description": "Whether the runtime code for the Workbox library should be included in the\ntop-level service worker, or split into a separate file that needs to be\ndeployed alongside the service worker. Keeping the runtime separate means\nthat users will not have to re-download the Workbox code each time your\ntop-level service worker changes.",
"default": false,
"type": "boolean"
},
"mode": {
"description": "If set to 'production', then an optimized service worker bundle that\nexcludes debugging info will be produced. If not explicitly configured\nhere, the `process.env.NODE_ENV` value will be used, and failing that, it\nwill fall back to `'production'`.",
"default": "production",
"type": [
"null",
"string"
]
},
"navigateFallback": {
"description": "If specified, all\n[navigation requests](https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests)\nfor URLs that aren't precached will be fulfilled with the HTML at the URL\nprovided. You must pass in the URL of an HTML document that is listed in\nyour precache manifest. This is meant to be used in a Single Page App\nscenario, in which you want all navigations to use common\n[App Shell HTML](https://developers.google.com/web/fundamentals/architecture/app-shell).",
"default": null,
"type": [
"null",
"string"
]
},
"navigateFallbackAllowlist": {
"description": "An optional array of regular expressions that restricts which URLs the\nconfigured `navigateFallback` behavior applies to. This is useful if only a\nsubset of your site's URLs should be treated as being part of a\n[Single Page App](https://en.wikipedia.org/wiki/Single-page_application).\nIf both `navigateFallbackDenylist` and `navigateFallbackAllowlist` are\nconfigured, the denylist takes precedent.\n\n*Note*: These RegExps may be evaluated against every destination URL during\na navigation. Avoid using\n[complex RegExps](https://github.com/GoogleChrome/workbox/issues/3077),\nor else your users may see delays when navigating your site.",
"type": "array",
"items": {
"$ref": "#/definitions/RegExp"
}
},
"navigateFallbackDenylist": {
"description": "An optional array of regular expressions that restricts which URLs the\nconfigured `navigateFallback` behavior applies to. This is useful if only a\nsubset of your site's URLs should be treated as being part of a\n[Single Page App](https://en.wikipedia.org/wiki/Single-page_application).\nIf both `navigateFallbackDenylist` and `navigateFallbackAllowlist` are\nconfigured, the denylist takes precedence.\n\n*Note*: These RegExps may be evaluated against every destination URL during\na navigation. Avoid using\n[complex RegExps](https://github.com/GoogleChrome/workbox/issues/3077),\nor else your users may see delays when navigating your site.",
"type": "array",
"items": {
"$ref": "#/definitions/RegExp"
}
},
"navigationPreload": {
"description": "Whether or not to enable\n[navigation preload](https://developers.google.com/web/tools/workbox/modules/workbox-navigation-preload)\nin the generated service worker. When set to true, you must also use\n`runtimeCaching` to set up an appropriate response strategy that will match\nnavigation requests, and make use of the preloaded response.",
"default": false,
"type": "boolean"
},
"offlineGoogleAnalytics": {
"description": "Controls whether or not to include support for\n[offline Google Analytics](https://developers.google.com/web/tools/workbox/guides/enable-offline-analytics).\nWhen `true`, the call to `workbox-google-analytics`'s `initialize()` will\nbe added to your generated service worker. When set to an `Object`, that\nobject will be passed in to the `initialize()` call, allowing you to\ncustomize the behavior.",
"default": false,
"anyOf": [
{
"$ref": "#/definitions/GoogleAnalyticsInitializeOptions"
},
{
"type": "boolean"
}
]
},
"runtimeCaching": {
"description": "When using Workbox's build tools to generate your service worker, you can\nspecify one or more runtime caching configurations. These are then\ntranslated to {@link workbox-routing.registerRoute} calls using the match\nand handler configuration you define.\n\nFor all of the options, see the {@link workbox-build.RuntimeCaching}\ndocumentation. The example below shows a typical configuration, with two\nruntime routes defined:",
"type": "array",
"items": {
"$ref": "#/definitions/RuntimeCaching"
}
},
"skipWaiting": {
"description": "Whether to add an unconditional call to [`skipWaiting()`](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#skip_the_waiting_phase)\nto the generated service worker. If `false`, then a `message` listener will\nbe added instead, allowing client pages to trigger `skipWaiting()` by\ncalling `postMessage({type: 'SKIP_WAITING'})` on a waiting service worker.",
"default": false,
"type": "boolean"
},
"sourcemap": {
"description": "Whether to create a sourcemap for the generated service worker files.",
"default": true,
"type": "boolean"
},
"swDest": {
"description": "The path and filename of the service worker file that will be created by\nthe build process, relative to the current working directory. It must end\nin '.js'.",
"type": "string"
},
"globDirectory": {
"description": "The local directory you wish to match `globPatterns` against. The path is\nrelative to the current directory.",
"type": "string"
}
},
"required": [
"swDest"
],
"definitions": {
"ManifestEntry": {
"type": "object",
"properties": {
"integrity": {
"type": "string"
},
"revision": {
"type": [
"null",
"string"
]
},
"url": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"revision",
"url"
]
},
"RegExp": {
"type": "object",
"properties": {
"source": {
"type": "string"
},
"global": {
"type": "boolean"
},
"ignoreCase": {
"type": "boolean"
},
"multiline": {
"type": "boolean"
},
"lastIndex": {
"type": "number"
},
"flags": {
"type": "string"
},
"sticky": {
"type": "boolean"
},
"unicode": {
"type": "boolean"
},
"dotAll": {
"type": "boolean"
},
"hasIndices": {
"type": "boolean"
}
},
"additionalProperties": false,
"required": [
"dotAll",
"flags",
"global",
"hasIndices",
"ignoreCase",
"lastIndex",
"multiline",
"source",
"sticky",
"unicode"
]
},
"GoogleAnalyticsInitializeOptions": {
"type": "object",
"properties": {
"cacheName": {
"type": "string"
},
"parameterOverrides": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"hitFilter": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
"RuntimeCaching": {
"type": "object",
"properties": {
"handler": {
"description": "This determines how the runtime route will generate a response.\nTo use one of the built-in {@link workbox-strategies}, provide its name,\nlike `'NetworkFirst'`.\nAlternatively, this can be a {@link workbox-core.RouteHandler} callback\nfunction with custom response logic.",
"anyOf": [
{
"$ref": "#/definitions/RouteHandlerCallback"
},
{
"$ref": "#/definitions/RouteHandlerObject"
},
{
"enum": [
"CacheFirst",
"CacheOnly",
"NetworkFirst",
"NetworkOnly",
"StaleWhileRevalidate"
],
"type": "string"
}
]
},
"method": {
"description": "The HTTP method to match against. The default value of `'GET'` is normally\nsufficient, unless you explicitly need to match `'POST'`, `'PUT'`, or\nanother type of request.",
"default": "GET",
"enum": [
"DELETE",
"GET",
"HEAD",
"PATCH",
"POST",
"PUT"
],
"type": "string"
},
"options": {
"type": "object",
"properties": {
"backgroundSync": {
"description": "Configuring this will add a\n{@link workbox-background-sync.BackgroundSyncPlugin} instance to the\n{@link workbox-strategies} configured in `handler`.",
"type": "object",
"properties": {
"name": {
"type": "string"
},
"options": {
"$ref": "#/definitions/QueueOptions"
}
},
"additionalProperties": false,
"required": [
"name"
]
},
"broadcastUpdate": {
"description": "Configuring this will add a\n{@link workbox-broadcast-update.BroadcastUpdatePlugin} instance to the\n{@link workbox-strategies} configured in `handler`.",
"type": "object",
"properties": {
"channelName": {
"type": "string"
},
"options": {
"$ref": "#/definitions/BroadcastCacheUpdateOptions"
}
},
"additionalProperties": false,
"required": [
"options"
]
},
"cacheableResponse": {
"description": "Configuring this will add a\n{@link workbox-cacheable-response.CacheableResponsePlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.",
"$ref": "#/definitions/CacheableResponseOptions"
},
"cacheName": {
"description": "If provided, this will set the `cacheName` property of the\n{@link workbox-strategies} configured in `handler`.",
"type": [
"null",
"string"
]
},
"expiration": {
"description": "Configuring this will add a\n{@link workbox-expiration.ExpirationPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.",
"$ref": "#/definitions/ExpirationPluginOptions"
},
"networkTimeoutSeconds": {
"description": "If provided, this will set the `networkTimeoutSeconds` property of the\n{@link workbox-strategies} configured in `handler`. Note that only\n`'NetworkFirst'` and `'NetworkOnly'` support `networkTimeoutSeconds`.",
"type": "number"
},
"plugins": {
"description": "Configuring this allows the use of one or more Workbox plugins that\ndon't have \"shortcut\" options (like `expiration` for\n{@link workbox-expiration.ExpirationPlugin}). The plugins provided here\nwill be added to the {@link workbox-strategies} configured in `handler`.",
"type": "array",
"items": {
"$ref": "#/definitions/WorkboxPlugin"
}
},
"precacheFallback": {
"description": "Configuring this will add a\n{@link workbox-precaching.PrecacheFallbackPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.",
"type": "object",
"properties": {
"fallbackURL": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"fallbackURL"
]
},
"rangeRequests": {
"description": "Enabling this will add a\n{@link workbox-range-requests.RangeRequestsPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.",
"type": "boolean"
},
"fetchOptions": {
"description": "Configuring this will pass along the `fetchOptions` value to\nthe {@link workbox-strategies} configured in `handler`.",
"$ref": "#/definitions/RequestInit"
},
"matchOptions": {
"description": "Configuring this will pass along the `matchOptions` value to\nthe {@link workbox-strategies} configured in `handler`.",
"$ref": "#/definitions/CacheQueryOptions"
}
},
"additionalProperties": false
},
"urlPattern": {
"description": "This match criteria determines whether the configured handler will\ngenerate a response for any requests that don't match one of the precached\nURLs. If multiple `RuntimeCaching` routes are defined, then the first one\nwhose `urlPattern` matches will be the one that responds.\n\nThis value directly maps to the first parameter passed to\n{@link workbox-routing.registerRoute}. It's recommended to use a\n{@link workbox-core.RouteMatchCallback} function for greatest flexibility.",
"anyOf": [
{
"$ref": "#/definitions/RegExp"
},
{
"$ref": "#/definitions/RouteMatchCallback"
},
{
"type": "string"
}
]
}
},
"additionalProperties": false,
"required": [
"handler",
"urlPattern"
]
},
"RouteHandlerCallback": {},
"RouteHandlerObject": {
"description": "An object with a `handle` method of type `RouteHandlerCallback`.\n\nA `Route` object can be created with either an `RouteHandlerCallback`\nfunction or this `RouteHandler` object. The benefit of the `RouteHandler`\nis it can be extended (as is done by the `workbox-strategies` package).",
"type": "object",
"properties": {
"handle": {
"$ref": "#/definitions/RouteHandlerCallback"
}
},
"additionalProperties": false,
"required": [
"handle"
]
},
"QueueOptions": {
"type": "object",
"properties": {
"forceSyncFallback": {
"type": "boolean"
},
"maxRetentionTime": {
"type": "number"
},
"onSync": {
"$ref": "#/definitions/OnSyncCallback"
}
},
"additionalProperties": false
},
"OnSyncCallback": {},
"BroadcastCacheUpdateOptions": {
"type": "object",
"properties": {
"headersToCheck": {
"type": "array",
"items": {
"type": "string"
}
},
"generatePayload": {
"type": "object",
"additionalProperties": false
},
"notifyAllClients": {
"type": "boolean"
}
},
"additionalProperties": false
},
"CacheableResponseOptions": {
"type": "object",
"properties": {
"statuses": {
"type": "array",
"items": {
"type": "number"
}
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"additionalProperties": false
},
"ExpirationPluginOptions": {
"type": "object",
"properties": {
"maxEntries": {
"type": "number"
},
"maxAgeSeconds": {
"type": "number"
},
"matchOptions": {
"$ref": "#/definitions/CacheQueryOptions"
},
"purgeOnQuotaError": {
"type": "boolean"
}
},
"additionalProperties": false
},
"CacheQueryOptions": {
"type": "object",
"properties": {
"ignoreMethod": {
"type": "boolean"
},
"ignoreSearch": {
"type": "boolean"
},
"ignoreVary": {
"type": "boolean"
}
},
"additionalProperties": false
},
"WorkboxPlugin": {
"description": "An object with optional lifecycle callback properties for the fetch and\ncache operations.",
"type": "object",
"properties": {
"cacheDidUpdate": {},
"cachedResponseWillBeUsed": {},
"cacheKeyWillBeUsed": {},
"cacheWillUpdate": {},
"fetchDidFail": {},
"fetchDidSucceed": {},
"handlerDidComplete": {},
"handlerDidError": {},
"handlerDidRespond": {},
"handlerWillRespond": {},
"handlerWillStart": {},
"requestWillFetch": {}
},
"additionalProperties": false
},
"CacheDidUpdateCallback": {
"type": "object",
"additionalProperties": false
},
"CachedResponseWillBeUsedCallback": {
"type": "object",
"additionalProperties": false
},
"CacheKeyWillBeUsedCallback": {
"type": "object",
"additionalProperties": false
},
"CacheWillUpdateCallback": {
"type": "object",
"additionalProperties": false
},
"FetchDidFailCallback": {
"type": "object",
"additionalProperties": false
},
"FetchDidSucceedCallback": {
"type": "object",
"additionalProperties": false
},
"HandlerDidCompleteCallback": {
"type": "object",
"additionalProperties": false
},
"HandlerDidErrorCallback": {
"type": "object",
"additionalProperties": false
},
"HandlerDidRespondCallback": {
"type": "object",
"additionalProperties": false
},
"HandlerWillRespondCallback": {
"type": "object",
"additionalProperties": false
},
"HandlerWillStartCallback": {
"type": "object",
"additionalProperties": false
},
"RequestWillFetchCallback": {
"type": "object",
"additionalProperties": false
},
"RequestInit": {
"type": "object",
"properties": {
"body": {
"anyOf": [
{
"$ref": "#/definitions/ArrayBuffer"
},
{
"$ref": "#/definitions/ArrayBufferView"
},
{
"$ref": "#/definitions/ReadableStream<any>"
},
{
"$ref": "#/definitions/Blob"
},
{
"$ref": "#/definitions/FormData"
},
{
"$ref": "#/definitions/URLSearchParams"
},
{
"type": [
"null",
"string"
]
}
]
},
"cache": {
"enum": [
"default",
"force-cache",
"no-cache",
"no-store",
"only-if-cached",
"reload"
],
"type": "string"
},
"credentials": {
"enum": [
"include",
"omit",
"same-origin"
],
"type": "string"
},
"headers": {
"anyOf": [
{
"$ref": "#/definitions/Record<string,string>"
},
{
"type": "array",
"items": {
"type": "array",
"items": [
{
"type": "string"
},
{
"type": "string"
}
],
"minItems": 2,
"maxItems": 2
}
},
{
"$ref": "#/definitions/Headers"
}
]
},
"integrity": {
"type": "string"
},
"keepalive": {
"type": "boolean"
},
"method": {
"type": "string"
},
"mode": {
"enum": [
"cors",
"navigate",
"no-cors",
"same-origin"
],
"type": "string"
},
"redirect": {
"enum": [
"error",
"follow",
"manual"
],
"type": "string"
},
"referrer": {
"type": "string"
},
"referrerPolicy": {
"enum": [
"",
"no-referrer",
"no-referrer-when-downgrade",
"origin",
"origin-when-cross-origin",
"same-origin",
"strict-origin",
"strict-origin-when-cross-origin",
"unsafe-url"
],
"type": "string"
},
"signal": {
"anyOf": [
{
"$ref": "#/definitions/AbortSignal"
},
{
"type": "null"
}
]
},
"window": {
"type": "null"
}
},
"additionalProperties": false
},
"ArrayBuffer": {
"type": "object",
"properties": {
"byteLength": {
"type": "number"
},
"__@toStringTag@34": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"__@toStringTag@34",
"byteLength"
]
},
"ArrayBufferView": {
"type": "object",
"properties": {
"buffer": {
"$ref": "#/definitions/ArrayBufferLike"
},
"byteLength": {
"type": "number"
},
"byteOffset": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"buffer",
"byteLength",
"byteOffset"
]
},
"ArrayBufferLike": {
"anyOf": [
{
"$ref": "#/definitions/ArrayBuffer"
},
{
"$ref": "#/definitions/SharedArrayBuffer"
}
]
},
"SharedArrayBuffer": {
"type": "object",
"properties": {
"byteLength": {
"type": "number"
},
"__@species@494": {
"$ref": "#/definitions/SharedArrayBuffer"
},
"__@toStringTag@34": {
"type": "string",
"const": "SharedArrayBuffer"
}
},
"additionalProperties": false,
"required": [
"__@species@494",
"__@toStringTag@34",
"byteLength"
]
},
"ReadableStream<any>": {
"type": "object",
"properties": {
"locked": {
"type": "boolean"
}
},
"additionalProperties": false,
"required": [
"locked"
]
},
"Blob": {
"type": "object",
"properties": {
"size": {
"type": "number"
},
"type": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"size",
"type"
]
},
"FormData": {
"type": "object",
"additionalProperties": false
},
"URLSearchParams": {
"type": "object",
"properties": {
"size": {
"description": "The total number of parameter entries.",
"type": "number"
}
},
"additionalProperties": false,
"required": [
"size"
]
},
"Record<string,string>": {
"type": "object",
"additionalProperties": false
},
"Headers": {
"type": "object",
"additionalProperties": false
},
"AbortSignal": {},
"RouteMatchCallback": {}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}

View file

@ -0,0 +1,163 @@
{
"additionalProperties": false,
"type": "object",
"properties": {
"additionalManifestEntries": {
"description": "A list of entries to be precached, in addition to any entries that are\ngenerated as part of the build configuration.",
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/definitions/ManifestEntry"
},
{
"type": "string"
}
]
}
},
"dontCacheBustURLsMatching": {
"description": "Assets that match this will be assumed to be uniquely versioned via their\nURL, and exempted from the normal HTTP cache-busting that's done when\npopulating the precache. While not required, it's recommended that if your\nexisting build process already inserts a `[hash]` value into each filename,\nyou provide a RegExp that will detect that, as it will reduce the bandwidth\nconsumed when precaching.",
"$ref": "#/definitions/RegExp"
},
"manifestTransforms": {
"description": "One or more functions which will be applied sequentially against the\ngenerated manifest. If `modifyURLPrefix` or `dontCacheBustURLsMatching` are\nalso specified, their corresponding transformations will be applied first.",
"type": "array",
"items": {}
},
"maximumFileSizeToCacheInBytes": {
"description": "This value can be used to determine the maximum size of files that will be\nprecached. This prevents you from inadvertently precaching very large files\nthat might have accidentally matched one of your patterns.",
"default": 2097152,
"type": "number"
},
"modifyURLPrefix": {
"description": "An object mapping string prefixes to replacement string values. This can be\nused to, e.g., remove or add a path prefix from a manifest entry if your\nweb hosting setup doesn't match your local filesystem setup. As an\nalternative with more flexibility, you can use the `manifestTransforms`\noption and provide a function that modifies the entries in the manifest\nusing whatever logic you provide.\n\nExample usage:\n\n```\n// Replace a '/dist/' prefix with '/', and also prepend\n// '/static' to every URL.\nmodifyURLPrefix: {\n '/dist/': '/',\n '': '/static',\n}\n```",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"globFollow": {
"description": "Determines whether or not symlinks are followed when generating the\nprecache manifest. For more information, see the definition of `follow` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).",
"default": true,
"type": "boolean"
},
"globIgnores": {
"description": "A set of patterns matching files to always exclude when generating the\nprecache manifest. For more information, see the definition of `ignore` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).",
"default": [
"**/node_modules/**/*"
],
"type": "array",
"items": {
"type": "string"
}
},
"globPatterns": {
"description": "Files matching any of these patterns will be included in the precache\nmanifest. For more information, see the\n[`glob` primer](https://github.com/isaacs/node-glob#glob-primer).",
"default": [
"**/*.{js,wasm,css,html}"
],
"type": "array",
"items": {
"type": "string"
}
},
"templatedURLs": {
"description": "If a URL is rendered based on some server-side logic, its contents may\ndepend on multiple files or on some other unique string value. The keys in\nthis object are server-rendered URLs. If the values are an array of\nstrings, they will be interpreted as `glob` patterns, and the contents of\nany files matching the patterns will be used to uniquely version the URL.\nIf used with a single string, it will be interpreted as unique versioning\ninformation that you've generated for a given URL.",
"type": "object",
"additionalProperties": {
"anyOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "string"
}
]
}
},
"globDirectory": {
"description": "The local directory you wish to match `globPatterns` against. The path is\nrelative to the current directory.",
"type": "string"
}
},
"required": [
"globDirectory"
],
"definitions": {
"ManifestEntry": {
"type": "object",
"properties": {
"integrity": {
"type": "string"
},
"revision": {
"type": [
"null",
"string"
]
},
"url": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"revision",
"url"
]
},
"RegExp": {
"type": "object",
"properties": {
"source": {
"type": "string"
},
"global": {
"type": "boolean"
},
"ignoreCase": {
"type": "boolean"
},
"multiline": {
"type": "boolean"
},
"lastIndex": {
"type": "number"
},
"flags": {
"type": "string"
},
"sticky": {
"type": "boolean"
},
"unicode": {
"type": "boolean"
},
"dotAll": {
"type": "boolean"
},
"hasIndices": {
"type": "boolean"
}
},
"additionalProperties": false,
"required": [
"dotAll",
"flags",
"global",
"hasIndices",
"ignoreCase",
"lastIndex",
"multiline",
"source",
"sticky",
"unicode"
]
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}

View file

@ -0,0 +1,178 @@
{
"additionalProperties": false,
"type": "object",
"properties": {
"additionalManifestEntries": {
"description": "A list of entries to be precached, in addition to any entries that are\ngenerated as part of the build configuration.",
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/definitions/ManifestEntry"
},
{
"type": "string"
}
]
}
},
"dontCacheBustURLsMatching": {
"description": "Assets that match this will be assumed to be uniquely versioned via their\nURL, and exempted from the normal HTTP cache-busting that's done when\npopulating the precache. While not required, it's recommended that if your\nexisting build process already inserts a `[hash]` value into each filename,\nyou provide a RegExp that will detect that, as it will reduce the bandwidth\nconsumed when precaching.",
"$ref": "#/definitions/RegExp"
},
"manifestTransforms": {
"description": "One or more functions which will be applied sequentially against the\ngenerated manifest. If `modifyURLPrefix` or `dontCacheBustURLsMatching` are\nalso specified, their corresponding transformations will be applied first.",
"type": "array",
"items": {}
},
"maximumFileSizeToCacheInBytes": {
"description": "This value can be used to determine the maximum size of files that will be\nprecached. This prevents you from inadvertently precaching very large files\nthat might have accidentally matched one of your patterns.",
"default": 2097152,
"type": "number"
},
"modifyURLPrefix": {
"description": "An object mapping string prefixes to replacement string values. This can be\nused to, e.g., remove or add a path prefix from a manifest entry if your\nweb hosting setup doesn't match your local filesystem setup. As an\nalternative with more flexibility, you can use the `manifestTransforms`\noption and provide a function that modifies the entries in the manifest\nusing whatever logic you provide.\n\nExample usage:\n\n```\n// Replace a '/dist/' prefix with '/', and also prepend\n// '/static' to every URL.\nmodifyURLPrefix: {\n '/dist/': '/',\n '': '/static',\n}\n```",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"globFollow": {
"description": "Determines whether or not symlinks are followed when generating the\nprecache manifest. For more information, see the definition of `follow` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).",
"default": true,
"type": "boolean"
},
"globIgnores": {
"description": "A set of patterns matching files to always exclude when generating the\nprecache manifest. For more information, see the definition of `ignore` in\nthe `glob` [documentation](https://github.com/isaacs/node-glob#options).",
"default": [
"**/node_modules/**/*"
],
"type": "array",
"items": {
"type": "string"
}
},
"globPatterns": {
"description": "Files matching any of these patterns will be included in the precache\nmanifest. For more information, see the\n[`glob` primer](https://github.com/isaacs/node-glob#glob-primer).",
"default": [
"**/*.{js,wasm,css,html}"
],
"type": "array",
"items": {
"type": "string"
}
},
"templatedURLs": {
"description": "If a URL is rendered based on some server-side logic, its contents may\ndepend on multiple files or on some other unique string value. The keys in\nthis object are server-rendered URLs. If the values are an array of\nstrings, they will be interpreted as `glob` patterns, and the contents of\nany files matching the patterns will be used to uniquely version the URL.\nIf used with a single string, it will be interpreted as unique versioning\ninformation that you've generated for a given URL.",
"type": "object",
"additionalProperties": {
"anyOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "string"
}
]
}
},
"injectionPoint": {
"description": "The string to find inside of the `swSrc` file. Once found, it will be\nreplaced by the generated precache manifest.",
"default": "self.__WB_MANIFEST",
"type": "string"
},
"swSrc": {
"description": "The path and filename of the service worker file that will be read during\nthe build process, relative to the current working directory.",
"type": "string"
},
"swDest": {
"description": "The path and filename of the service worker file that will be created by\nthe build process, relative to the current working directory. It must end\nin '.js'.",
"type": "string"
},
"globDirectory": {
"description": "The local directory you wish to match `globPatterns` against. The path is\nrelative to the current directory.",
"type": "string"
}
},
"required": [
"globDirectory",
"swDest",
"swSrc"
],
"definitions": {
"ManifestEntry": {
"type": "object",
"properties": {
"integrity": {
"type": "string"
},
"revision": {
"type": [
"null",
"string"
]
},
"url": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"revision",
"url"
]
},
"RegExp": {
"type": "object",
"properties": {
"source": {
"type": "string"
},
"global": {
"type": "boolean"
},
"ignoreCase": {
"type": "boolean"
},
"multiline": {
"type": "boolean"
},
"lastIndex": {
"type": "number"
},
"flags": {
"type": "string"
},
"sticky": {
"type": "boolean"
},
"unicode": {
"type": "boolean"
},
"dotAll": {
"type": "boolean"
},
"hasIndices": {
"type": "boolean"
}
},
"additionalProperties": false,
"required": [
"dotAll",
"flags",
"global",
"hasIndices",
"ignoreCase",
"lastIndex",
"multiline",
"source",
"sticky",
"unicode"
]
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}

View file

@ -0,0 +1,861 @@
{
"additionalProperties": false,
"type": "object",
"properties": {
"additionalManifestEntries": {
"description": "A list of entries to be precached, in addition to any entries that are\ngenerated as part of the build configuration.",
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/definitions/ManifestEntry"
},
{
"type": "string"
}
]
}
},
"dontCacheBustURLsMatching": {
"description": "Assets that match this will be assumed to be uniquely versioned via their\nURL, and exempted from the normal HTTP cache-busting that's done when\npopulating the precache. While not required, it's recommended that if your\nexisting build process already inserts a `[hash]` value into each filename,\nyou provide a RegExp that will detect that, as it will reduce the bandwidth\nconsumed when precaching.",
"$ref": "#/definitions/RegExp"
},
"manifestTransforms": {
"description": "One or more functions which will be applied sequentially against the\ngenerated manifest. If `modifyURLPrefix` or `dontCacheBustURLsMatching` are\nalso specified, their corresponding transformations will be applied first.",
"type": "array",
"items": {}
},
"maximumFileSizeToCacheInBytes": {
"description": "This value can be used to determine the maximum size of files that will be\nprecached. This prevents you from inadvertently precaching very large files\nthat might have accidentally matched one of your patterns.",
"default": 2097152,
"type": "number"
},
"modifyURLPrefix": {
"description": "An object mapping string prefixes to replacement string values. This can be\nused to, e.g., remove or add a path prefix from a manifest entry if your\nweb hosting setup doesn't match your local filesystem setup. As an\nalternative with more flexibility, you can use the `manifestTransforms`\noption and provide a function that modifies the entries in the manifest\nusing whatever logic you provide.\n\nExample usage:\n\n```\n// Replace a '/dist/' prefix with '/', and also prepend\n// '/static' to every URL.\nmodifyURLPrefix: {\n '/dist/': '/',\n '': '/static',\n}\n```",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"chunks": {
"description": "One or more chunk names whose corresponding output files should be included\nin the precache manifest.",
"type": "array",
"items": {
"type": "string"
}
},
"exclude": {
"description": "One or more specifiers used to exclude assets from the precache manifest.\nThis is interpreted following\n[the same rules](https://webpack.js.org/configuration/module/#condition)\nas `webpack`'s standard `exclude` option.\nIf not provided, the default value is `[/\\.map$/, /^manifest.*\\.js$]`.",
"type": "array",
"items": {}
},
"excludeChunks": {
"description": "One or more chunk names whose corresponding output files should be excluded\nfrom the precache manifest.",
"type": "array",
"items": {
"type": "string"
}
},
"include": {
"description": "One or more specifiers used to include assets in the precache manifest.\nThis is interpreted following\n[the same rules](https://webpack.js.org/configuration/module/#condition)\nas `webpack`'s standard `include` option.",
"type": "array",
"items": {}
},
"mode": {
"description": "If set to 'production', then an optimized service worker bundle that\nexcludes debugging info will be produced. If not explicitly configured\nhere, the `process.env.NODE_ENV` value will be used, and failing that, it\nwill fall back to `'production'`.",
"default": "production",
"type": [
"null",
"string"
]
},
"babelPresetEnvTargets": {
"description": "The [targets](https://babeljs.io/docs/en/babel-preset-env#targets) to pass\nto `babel-preset-env` when transpiling the service worker bundle.",
"default": [
"chrome >= 56"
],
"type": "array",
"items": {
"type": "string"
}
},
"cacheId": {
"description": "An optional ID to be prepended to cache names. This is primarily useful for\nlocal development where multiple sites may be served from the same\n`http://localhost:port` origin.",
"type": [
"null",
"string"
]
},
"cleanupOutdatedCaches": {
"description": "Whether or not Workbox should attempt to identify and delete any precaches\ncreated by older, incompatible versions.",
"default": false,
"type": "boolean"
},
"clientsClaim": {
"description": "Whether or not the service worker should [start controlling](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#clientsclaim)\nany existing clients as soon as it activates.",
"default": false,
"type": "boolean"
},
"directoryIndex": {
"description": "If a navigation request for a URL ending in `/` fails to match a precached\nURL, this value will be appended to the URL and that will be checked for a\nprecache match. This should be set to what your web server is using for its\ndirectory index.",
"type": [
"null",
"string"
]
},
"disableDevLogs": {
"default": false,
"type": "boolean"
},
"ignoreURLParametersMatching": {
"description": "Any search parameter names that match against one of the RegExp in this\narray will be removed before looking for a precache match. This is useful\nif your users might request URLs that contain, for example, URL parameters\nused to track the source of the traffic. If not provided, the default value\nis `[/^utm_/, /^fbclid$/]`.",
"type": "array",
"items": {
"$ref": "#/definitions/RegExp"
}
},
"importScripts": {
"description": "A list of JavaScript files that should be passed to\n[`importScripts()`](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts)\ninside the generated service worker file. This is useful when you want to\nlet Workbox create your top-level service worker file, but want to include\nsome additional code, such as a push event listener.",
"type": "array",
"items": {
"type": "string"
}
},
"inlineWorkboxRuntime": {
"description": "Whether the runtime code for the Workbox library should be included in the\ntop-level service worker, or split into a separate file that needs to be\ndeployed alongside the service worker. Keeping the runtime separate means\nthat users will not have to re-download the Workbox code each time your\ntop-level service worker changes.",
"default": false,
"type": "boolean"
},
"navigateFallback": {
"description": "If specified, all\n[navigation requests](https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests)\nfor URLs that aren't precached will be fulfilled with the HTML at the URL\nprovided. You must pass in the URL of an HTML document that is listed in\nyour precache manifest. This is meant to be used in a Single Page App\nscenario, in which you want all navigations to use common\n[App Shell HTML](https://developers.google.com/web/fundamentals/architecture/app-shell).",
"default": null,
"type": [
"null",
"string"
]
},
"navigateFallbackAllowlist": {
"description": "An optional array of regular expressions that restricts which URLs the\nconfigured `navigateFallback` behavior applies to. This is useful if only a\nsubset of your site's URLs should be treated as being part of a\n[Single Page App](https://en.wikipedia.org/wiki/Single-page_application).\nIf both `navigateFallbackDenylist` and `navigateFallbackAllowlist` are\nconfigured, the denylist takes precedent.\n\n*Note*: These RegExps may be evaluated against every destination URL during\na navigation. Avoid using\n[complex RegExps](https://github.com/GoogleChrome/workbox/issues/3077),\nor else your users may see delays when navigating your site.",
"type": "array",
"items": {
"$ref": "#/definitions/RegExp"
}
},
"navigateFallbackDenylist": {
"description": "An optional array of regular expressions that restricts which URLs the\nconfigured `navigateFallback` behavior applies to. This is useful if only a\nsubset of your site's URLs should be treated as being part of a\n[Single Page App](https://en.wikipedia.org/wiki/Single-page_application).\nIf both `navigateFallbackDenylist` and `navigateFallbackAllowlist` are\nconfigured, the denylist takes precedence.\n\n*Note*: These RegExps may be evaluated against every destination URL during\na navigation. Avoid using\n[complex RegExps](https://github.com/GoogleChrome/workbox/issues/3077),\nor else your users may see delays when navigating your site.",
"type": "array",
"items": {
"$ref": "#/definitions/RegExp"
}
},
"navigationPreload": {
"description": "Whether or not to enable\n[navigation preload](https://developers.google.com/web/tools/workbox/modules/workbox-navigation-preload)\nin the generated service worker. When set to true, you must also use\n`runtimeCaching` to set up an appropriate response strategy that will match\nnavigation requests, and make use of the preloaded response.",
"default": false,
"type": "boolean"
},
"offlineGoogleAnalytics": {
"description": "Controls whether or not to include support for\n[offline Google Analytics](https://developers.google.com/web/tools/workbox/guides/enable-offline-analytics).\nWhen `true`, the call to `workbox-google-analytics`'s `initialize()` will\nbe added to your generated service worker. When set to an `Object`, that\nobject will be passed in to the `initialize()` call, allowing you to\ncustomize the behavior.",
"default": false,
"anyOf": [
{
"$ref": "#/definitions/GoogleAnalyticsInitializeOptions"
},
{
"type": "boolean"
}
]
},
"runtimeCaching": {
"description": "When using Workbox's build tools to generate your service worker, you can\nspecify one or more runtime caching configurations. These are then\ntranslated to {@link workbox-routing.registerRoute} calls using the match\nand handler configuration you define.\n\nFor all of the options, see the {@link workbox-build.RuntimeCaching}\ndocumentation. The example below shows a typical configuration, with two\nruntime routes defined:",
"type": "array",
"items": {
"$ref": "#/definitions/RuntimeCaching"
}
},
"skipWaiting": {
"description": "Whether to add an unconditional call to [`skipWaiting()`](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#skip_the_waiting_phase)\nto the generated service worker. If `false`, then a `message` listener will\nbe added instead, allowing client pages to trigger `skipWaiting()` by\ncalling `postMessage({type: 'SKIP_WAITING'})` on a waiting service worker.",
"default": false,
"type": "boolean"
},
"sourcemap": {
"description": "Whether to create a sourcemap for the generated service worker files.",
"default": true,
"type": "boolean"
},
"importScriptsViaChunks": {
"description": "One or more names of webpack chunks. The content of those chunks will be\nincluded in the generated service worker, via a call to `importScripts()`.",
"type": "array",
"items": {
"type": "string"
}
},
"swDest": {
"description": "The asset name of the service worker file created by this plugin.",
"default": "service-worker.js",
"type": "string"
}
},
"definitions": {
"ManifestEntry": {
"type": "object",
"properties": {
"integrity": {
"type": "string"
},
"revision": {
"type": [
"null",
"string"
]
},
"url": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"revision",
"url"
]
},
"RegExp": {
"type": "object",
"properties": {
"source": {
"type": "string"
},
"global": {
"type": "boolean"
},
"ignoreCase": {
"type": "boolean"
},
"multiline": {
"type": "boolean"
},
"lastIndex": {
"type": "number"
},
"flags": {
"type": "string"
},
"sticky": {
"type": "boolean"
},
"unicode": {
"type": "boolean"
},
"dotAll": {
"type": "boolean"
},
"hasIndices": {
"type": "boolean"
}
},
"additionalProperties": false,
"required": [
"dotAll",
"flags",
"global",
"hasIndices",
"ignoreCase",
"lastIndex",
"multiline",
"source",
"sticky",
"unicode"
]
},
"GoogleAnalyticsInitializeOptions": {
"type": "object",
"properties": {
"cacheName": {
"type": "string"
},
"parameterOverrides": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"hitFilter": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
"RuntimeCaching": {
"type": "object",
"properties": {
"handler": {
"description": "This determines how the runtime route will generate a response.\nTo use one of the built-in {@link workbox-strategies}, provide its name,\nlike `'NetworkFirst'`.\nAlternatively, this can be a {@link workbox-core.RouteHandler} callback\nfunction with custom response logic.",
"anyOf": [
{
"$ref": "#/definitions/RouteHandlerCallback"
},
{
"$ref": "#/definitions/RouteHandlerObject"
},
{
"enum": [
"CacheFirst",
"CacheOnly",
"NetworkFirst",
"NetworkOnly",
"StaleWhileRevalidate"
],
"type": "string"
}
]
},
"method": {
"description": "The HTTP method to match against. The default value of `'GET'` is normally\nsufficient, unless you explicitly need to match `'POST'`, `'PUT'`, or\nanother type of request.",
"default": "GET",
"enum": [
"DELETE",
"GET",
"HEAD",
"PATCH",
"POST",
"PUT"
],
"type": "string"
},
"options": {
"type": "object",
"properties": {
"backgroundSync": {
"description": "Configuring this will add a\n{@link workbox-background-sync.BackgroundSyncPlugin} instance to the\n{@link workbox-strategies} configured in `handler`.",
"type": "object",
"properties": {
"name": {
"type": "string"
},
"options": {
"$ref": "#/definitions/QueueOptions"
}
},
"additionalProperties": false,
"required": [
"name"
]
},
"broadcastUpdate": {
"description": "Configuring this will add a\n{@link workbox-broadcast-update.BroadcastUpdatePlugin} instance to the\n{@link workbox-strategies} configured in `handler`.",
"type": "object",
"properties": {
"channelName": {
"type": "string"
},
"options": {
"$ref": "#/definitions/BroadcastCacheUpdateOptions"
}
},
"additionalProperties": false,
"required": [
"options"
]
},
"cacheableResponse": {
"description": "Configuring this will add a\n{@link workbox-cacheable-response.CacheableResponsePlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.",
"$ref": "#/definitions/CacheableResponseOptions"
},
"cacheName": {
"description": "If provided, this will set the `cacheName` property of the\n{@link workbox-strategies} configured in `handler`.",
"type": [
"null",
"string"
]
},
"expiration": {
"description": "Configuring this will add a\n{@link workbox-expiration.ExpirationPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.",
"$ref": "#/definitions/ExpirationPluginOptions"
},
"networkTimeoutSeconds": {
"description": "If provided, this will set the `networkTimeoutSeconds` property of the\n{@link workbox-strategies} configured in `handler`. Note that only\n`'NetworkFirst'` and `'NetworkOnly'` support `networkTimeoutSeconds`.",
"type": "number"
},
"plugins": {
"description": "Configuring this allows the use of one or more Workbox plugins that\ndon't have \"shortcut\" options (like `expiration` for\n{@link workbox-expiration.ExpirationPlugin}). The plugins provided here\nwill be added to the {@link workbox-strategies} configured in `handler`.",
"type": "array",
"items": {
"$ref": "#/definitions/WorkboxPlugin"
}
},
"precacheFallback": {
"description": "Configuring this will add a\n{@link workbox-precaching.PrecacheFallbackPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.",
"type": "object",
"properties": {
"fallbackURL": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"fallbackURL"
]
},
"rangeRequests": {
"description": "Enabling this will add a\n{@link workbox-range-requests.RangeRequestsPlugin} instance to\nthe {@link workbox-strategies} configured in `handler`.",
"type": "boolean"
},
"fetchOptions": {
"description": "Configuring this will pass along the `fetchOptions` value to\nthe {@link workbox-strategies} configured in `handler`.",
"$ref": "#/definitions/RequestInit"
},
"matchOptions": {
"description": "Configuring this will pass along the `matchOptions` value to\nthe {@link workbox-strategies} configured in `handler`.",
"$ref": "#/definitions/CacheQueryOptions"
}
},
"additionalProperties": false
},
"urlPattern": {
"description": "This match criteria determines whether the configured handler will\ngenerate a response for any requests that don't match one of the precached\nURLs. If multiple `RuntimeCaching` routes are defined, then the first one\nwhose `urlPattern` matches will be the one that responds.\n\nThis value directly maps to the first parameter passed to\n{@link workbox-routing.registerRoute}. It's recommended to use a\n{@link workbox-core.RouteMatchCallback} function for greatest flexibility.",
"anyOf": [
{
"$ref": "#/definitions/RegExp"
},
{
"$ref": "#/definitions/RouteMatchCallback"
},
{
"type": "string"
}
]
}
},
"additionalProperties": false,
"required": [
"handler",
"urlPattern"
]
},
"RouteHandlerCallback": {},
"RouteHandlerObject": {
"description": "An object with a `handle` method of type `RouteHandlerCallback`.\n\nA `Route` object can be created with either an `RouteHandlerCallback`\nfunction or this `RouteHandler` object. The benefit of the `RouteHandler`\nis it can be extended (as is done by the `workbox-strategies` package).",
"type": "object",
"properties": {
"handle": {
"$ref": "#/definitions/RouteHandlerCallback"
}
},
"additionalProperties": false,
"required": [
"handle"
]
},
"QueueOptions": {
"type": "object",
"properties": {
"forceSyncFallback": {
"type": "boolean"
},
"maxRetentionTime": {
"type": "number"
},
"onSync": {
"$ref": "#/definitions/OnSyncCallback"
}
},
"additionalProperties": false
},
"OnSyncCallback": {},
"BroadcastCacheUpdateOptions": {
"type": "object",
"properties": {
"headersToCheck": {
"type": "array",
"items": {
"type": "string"
}
},
"generatePayload": {
"type": "object",
"additionalProperties": false
},
"notifyAllClients": {
"type": "boolean"
}
},
"additionalProperties": false
},
"CacheableResponseOptions": {
"type": "object",
"properties": {
"statuses": {
"type": "array",
"items": {
"type": "number"
}
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"additionalProperties": false
},
"ExpirationPluginOptions": {
"type": "object",
"properties": {
"maxEntries": {
"type": "number"
},
"maxAgeSeconds": {
"type": "number"
},
"matchOptions": {
"$ref": "#/definitions/CacheQueryOptions"
},
"purgeOnQuotaError": {
"type": "boolean"
}
},
"additionalProperties": false
},
"CacheQueryOptions": {
"type": "object",
"properties": {
"ignoreMethod": {
"type": "boolean"
},
"ignoreSearch": {
"type": "boolean"
},
"ignoreVary": {
"type": "boolean"
}
},
"additionalProperties": false
},
"WorkboxPlugin": {
"description": "An object with optional lifecycle callback properties for the fetch and\ncache operations.",
"type": "object",
"properties": {
"cacheDidUpdate": {},
"cachedResponseWillBeUsed": {},
"cacheKeyWillBeUsed": {},
"cacheWillUpdate": {},
"fetchDidFail": {},
"fetchDidSucceed": {},
"handlerDidComplete": {},
"handlerDidError": {},
"handlerDidRespond": {},
"handlerWillRespond": {},
"handlerWillStart": {},
"requestWillFetch": {}
},
"additionalProperties": false
},
"CacheDidUpdateCallback": {
"type": "object",
"additionalProperties": false
},
"CachedResponseWillBeUsedCallback": {
"type": "object",
"additionalProperties": false
},
"CacheKeyWillBeUsedCallback": {
"type": "object",
"additionalProperties": false
},
"CacheWillUpdateCallback": {
"type": "object",
"additionalProperties": false
},
"FetchDidFailCallback": {
"type": "object",
"additionalProperties": false
},
"FetchDidSucceedCallback": {
"type": "object",
"additionalProperties": false
},
"HandlerDidCompleteCallback": {
"type": "object",
"additionalProperties": false
},
"HandlerDidErrorCallback": {
"type": "object",
"additionalProperties": false
},
"HandlerDidRespondCallback": {
"type": "object",
"additionalProperties": false
},
"HandlerWillRespondCallback": {
"type": "object",
"additionalProperties": false
},
"HandlerWillStartCallback": {
"type": "object",
"additionalProperties": false
},
"RequestWillFetchCallback": {
"type": "object",
"additionalProperties": false
},
"RequestInit": {
"type": "object",
"properties": {
"body": {
"anyOf": [
{
"$ref": "#/definitions/ArrayBuffer"
},
{
"$ref": "#/definitions/ArrayBufferView"
},
{
"$ref": "#/definitions/ReadableStream<any>"
},
{
"$ref": "#/definitions/Blob"
},
{
"$ref": "#/definitions/FormData"
},
{
"$ref": "#/definitions/URLSearchParams"
},
{
"type": [
"null",
"string"
]
}
]
},
"cache": {
"enum": [
"default",
"force-cache",
"no-cache",
"no-store",
"only-if-cached",
"reload"
],
"type": "string"
},
"credentials": {
"enum": [
"include",
"omit",
"same-origin"
],
"type": "string"
},
"headers": {
"anyOf": [
{
"$ref": "#/definitions/Record<string,string>"
},
{
"type": "array",
"items": {
"type": "array",
"items": [
{
"type": "string"
},
{
"type": "string"
}
],
"minItems": 2,
"maxItems": 2
}
},
{
"$ref": "#/definitions/Headers"
}
]
},
"integrity": {
"type": "string"
},
"keepalive": {
"type": "boolean"
},
"method": {
"type": "string"
},
"mode": {
"enum": [
"cors",
"navigate",
"no-cors",
"same-origin"
],
"type": "string"
},
"redirect": {
"enum": [
"error",
"follow",
"manual"
],
"type": "string"
},
"referrer": {
"type": "string"
},
"referrerPolicy": {
"enum": [
"",
"no-referrer",
"no-referrer-when-downgrade",
"origin",
"origin-when-cross-origin",
"same-origin",
"strict-origin",
"strict-origin-when-cross-origin",
"unsafe-url"
],
"type": "string"
},
"signal": {
"anyOf": [
{
"$ref": "#/definitions/AbortSignal"
},
{
"type": "null"
}
]
},
"window": {
"type": "null"
}
},
"additionalProperties": false
},
"ArrayBuffer": {
"type": "object",
"properties": {
"byteLength": {
"type": "number"
},
"__@toStringTag@34": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"__@toStringTag@34",
"byteLength"
]
},
"ArrayBufferView": {
"type": "object",
"properties": {
"buffer": {
"$ref": "#/definitions/ArrayBufferLike"
},
"byteLength": {
"type": "number"
},
"byteOffset": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"buffer",
"byteLength",
"byteOffset"
]
},
"ArrayBufferLike": {
"anyOf": [
{
"$ref": "#/definitions/ArrayBuffer"
},
{
"$ref": "#/definitions/SharedArrayBuffer"
}
]
},
"SharedArrayBuffer": {
"type": "object",
"properties": {
"byteLength": {
"type": "number"
},
"__@species@494": {
"$ref": "#/definitions/SharedArrayBuffer"
},
"__@toStringTag@34": {
"type": "string",
"const": "SharedArrayBuffer"
}
},
"additionalProperties": false,
"required": [
"__@species@494",
"__@toStringTag@34",
"byteLength"
]
},
"ReadableStream<any>": {
"type": "object",
"properties": {
"locked": {
"type": "boolean"
}
},
"additionalProperties": false,
"required": [
"locked"
]
},
"Blob": {
"type": "object",
"properties": {
"size": {
"type": "number"
},
"type": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"size",
"type"
]
},
"FormData": {
"type": "object",
"additionalProperties": false
},
"URLSearchParams": {
"type": "object",
"properties": {
"size": {
"description": "The total number of parameter entries.",
"type": "number"
}
},
"additionalProperties": false,
"required": [
"size"
]
},
"Record<string,string>": {
"type": "object",
"additionalProperties": false
},
"Headers": {
"type": "object",
"additionalProperties": false
},
"AbortSignal": {},
"RouteMatchCallback": {}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}

View file

@ -0,0 +1,171 @@
{
"additionalProperties": false,
"type": "object",
"properties": {
"additionalManifestEntries": {
"description": "A list of entries to be precached, in addition to any entries that are\ngenerated as part of the build configuration.",
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/definitions/ManifestEntry"
},
{
"type": "string"
}
]
}
},
"dontCacheBustURLsMatching": {
"description": "Assets that match this will be assumed to be uniquely versioned via their\nURL, and exempted from the normal HTTP cache-busting that's done when\npopulating the precache. While not required, it's recommended that if your\nexisting build process already inserts a `[hash]` value into each filename,\nyou provide a RegExp that will detect that, as it will reduce the bandwidth\nconsumed when precaching.",
"$ref": "#/definitions/RegExp"
},
"manifestTransforms": {
"description": "One or more functions which will be applied sequentially against the\ngenerated manifest. If `modifyURLPrefix` or `dontCacheBustURLsMatching` are\nalso specified, their corresponding transformations will be applied first.",
"type": "array",
"items": {}
},
"maximumFileSizeToCacheInBytes": {
"description": "This value can be used to determine the maximum size of files that will be\nprecached. This prevents you from inadvertently precaching very large files\nthat might have accidentally matched one of your patterns.",
"default": 2097152,
"type": "number"
},
"modifyURLPrefix": {
"description": "An object mapping string prefixes to replacement string values. This can be\nused to, e.g., remove or add a path prefix from a manifest entry if your\nweb hosting setup doesn't match your local filesystem setup. As an\nalternative with more flexibility, you can use the `manifestTransforms`\noption and provide a function that modifies the entries in the manifest\nusing whatever logic you provide.\n\nExample usage:\n\n```\n// Replace a '/dist/' prefix with '/', and also prepend\n// '/static' to every URL.\nmodifyURLPrefix: {\n '/dist/': '/',\n '': '/static',\n}\n```",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"chunks": {
"description": "One or more chunk names whose corresponding output files should be included\nin the precache manifest.",
"type": "array",
"items": {
"type": "string"
}
},
"exclude": {
"description": "One or more specifiers used to exclude assets from the precache manifest.\nThis is interpreted following\n[the same rules](https://webpack.js.org/configuration/module/#condition)\nas `webpack`'s standard `exclude` option.\nIf not provided, the default value is `[/\\.map$/, /^manifest.*\\.js$]`.",
"type": "array",
"items": {}
},
"excludeChunks": {
"description": "One or more chunk names whose corresponding output files should be excluded\nfrom the precache manifest.",
"type": "array",
"items": {
"type": "string"
}
},
"include": {
"description": "One or more specifiers used to include assets in the precache manifest.\nThis is interpreted following\n[the same rules](https://webpack.js.org/configuration/module/#condition)\nas `webpack`'s standard `include` option.",
"type": "array",
"items": {}
},
"mode": {
"description": "If set to 'production', then an optimized service worker bundle that\nexcludes debugging info will be produced. If not explicitly configured\nhere, the `mode` value configured in the current `webpack` compilation\nwill be used.",
"type": [
"null",
"string"
]
},
"injectionPoint": {
"description": "The string to find inside of the `swSrc` file. Once found, it will be\nreplaced by the generated precache manifest.",
"default": "self.__WB_MANIFEST",
"type": "string"
},
"swSrc": {
"description": "The path and filename of the service worker file that will be read during\nthe build process, relative to the current working directory.",
"type": "string"
},
"compileSrc": {
"description": "When `true` (the default), the `swSrc` file will be compiled by webpack.\nWhen `false`, compilation will not occur (and `webpackCompilationPlugins`\ncan't be used.) Set to `false` if you want to inject the manifest into,\ne.g., a JSON file.",
"default": true,
"type": "boolean"
},
"swDest": {
"description": "The asset name of the service worker file that will be created by this\nplugin. If omitted, the name will be based on the `swSrc` name.",
"type": "string"
},
"webpackCompilationPlugins": {
"description": "Optional `webpack` plugins that will be used when compiling the `swSrc`\ninput file. Only valid if `compileSrc` is `true`.",
"type": "array",
"items": {}
}
},
"required": [
"swSrc"
],
"definitions": {
"ManifestEntry": {
"type": "object",
"properties": {
"integrity": {
"type": "string"
},
"revision": {
"type": [
"null",
"string"
]
},
"url": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"revision",
"url"
]
},
"RegExp": {
"type": "object",
"properties": {
"source": {
"type": "string"
},
"global": {
"type": "boolean"
},
"ignoreCase": {
"type": "boolean"
},
"multiline": {
"type": "boolean"
},
"lastIndex": {
"type": "number"
},
"flags": {
"type": "string"
},
"sticky": {
"type": "boolean"
},
"unicode": {
"type": "boolean"
},
"dotAll": {
"type": "boolean"
},
"hasIndices": {
"type": "boolean"
}
},
"additionalProperties": false,
"required": [
"dotAll",
"flags",
"global",
"hasIndices",
"ignoreCase",
"lastIndex",
"multiline",
"source",
"sticky",
"unicode"
]
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}

View file

@ -0,0 +1 @@
export declare const swTemplate = "/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n<% if (importScripts) { %>\nimportScripts(\n <%= importScripts.map(JSON.stringify).join(',\\n ') %>\n);\n<% } %>\n\n<% if (navigationPreload) { %><%= use('workbox-navigation-preload', 'enable') %>();<% } %>\n\n<% if (cacheId) { %><%= use('workbox-core', 'setCacheNameDetails') %>({prefix: <%= JSON.stringify(cacheId) %>});<% } %>\n\n<% if (skipWaiting) { %>\nself.skipWaiting();\n<% } else { %>\nself.addEventListener('message', (event) => {\n if (event.data && event.data.type === 'SKIP_WAITING') {\n self.skipWaiting();\n }\n});\n<% } %>\n<% if (clientsClaim) { %><%= use('workbox-core', 'clientsClaim') %>();<% } %>\n\n<% if (Array.isArray(manifestEntries) && manifestEntries.length > 0) {%>\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\n<%= use('workbox-precaching', 'precacheAndRoute') %>(<%= JSON.stringify(manifestEntries, null, 2) %>, <%= precacheOptionsString %>);\n<% if (cleanupOutdatedCaches) { %><%= use('workbox-precaching', 'cleanupOutdatedCaches') %>();<% } %>\n<% if (navigateFallback) { %><%= use('workbox-routing', 'registerRoute') %>(new <%= use('workbox-routing', 'NavigationRoute') %>(<%= use('workbox-precaching', 'createHandlerBoundToURL') %>(<%= JSON.stringify(navigateFallback) %>)<% if (navigateFallbackAllowlist || navigateFallbackDenylist) { %>, {\n <% if (navigateFallbackAllowlist) { %>allowlist: [<%= navigateFallbackAllowlist %>],<% } %>\n <% if (navigateFallbackDenylist) { %>denylist: [<%= navigateFallbackDenylist %>],<% } %>\n}<% } %>));<% } %>\n<% } %>\n\n<% if (runtimeCaching) { runtimeCaching.forEach(runtimeCachingString => {%><%= runtimeCachingString %><% });} %>\n\n<% if (offlineAnalyticsConfigString) { %><%= use('workbox-google-analytics', 'initialize') %>(<%= offlineAnalyticsConfigString %>);<% } %>\n\n<% if (disableDevLogs) { %>self.__WB_DISABLE_DEV_LOGS = true;<% } %>";

View file

@ -0,0 +1,62 @@
"use strict";
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.swTemplate = void 0;
exports.swTemplate = `/**
* Welcome to your Workbox-powered service worker!
*
* You'll need to register this file in your web app.
* See https://goo.gl/nhQhGp
*
* The rest of the code is auto-generated. Please don't update this file
* directly; instead, make changes to your Workbox build configuration
* and re-run your build process.
* See https://goo.gl/2aRDsh
*/
<% if (importScripts) { %>
importScripts(
<%= importScripts.map(JSON.stringify).join(',\\n ') %>
);
<% } %>
<% if (navigationPreload) { %><%= use('workbox-navigation-preload', 'enable') %>();<% } %>
<% if (cacheId) { %><%= use('workbox-core', 'setCacheNameDetails') %>({prefix: <%= JSON.stringify(cacheId) %>});<% } %>
<% if (skipWaiting) { %>
self.skipWaiting();
<% } else { %>
self.addEventListener('message', (event) => {
if (event.data && event.data.type === 'SKIP_WAITING') {
self.skipWaiting();
}
});
<% } %>
<% if (clientsClaim) { %><%= use('workbox-core', 'clientsClaim') %>();<% } %>
<% if (Array.isArray(manifestEntries) && manifestEntries.length > 0) {%>
/**
* The precacheAndRoute() method efficiently caches and responds to
* requests for URLs in the manifest.
* See https://goo.gl/S9QRab
*/
<%= use('workbox-precaching', 'precacheAndRoute') %>(<%= JSON.stringify(manifestEntries, null, 2) %>, <%= precacheOptionsString %>);
<% if (cleanupOutdatedCaches) { %><%= use('workbox-precaching', 'cleanupOutdatedCaches') %>();<% } %>
<% if (navigateFallback) { %><%= use('workbox-routing', 'registerRoute') %>(new <%= use('workbox-routing', 'NavigationRoute') %>(<%= use('workbox-precaching', 'createHandlerBoundToURL') %>(<%= JSON.stringify(navigateFallback) %>)<% if (navigateFallbackAllowlist || navigateFallbackDenylist) { %>, {
<% if (navigateFallbackAllowlist) { %>allowlist: [<%= navigateFallbackAllowlist %>],<% } %>
<% if (navigateFallbackDenylist) { %>denylist: [<%= navigateFallbackDenylist %>],<% } %>
}<% } %>));<% } %>
<% } %>
<% if (runtimeCaching) { runtimeCaching.forEach(runtimeCachingString => {%><%= runtimeCachingString %><% });} %>
<% if (offlineAnalyticsConfigString) { %><%= use('workbox-google-analytics', 'initialize') %>(<%= offlineAnalyticsConfigString %>);<% } %>
<% if (disableDevLogs) { %>self.__WB_DISABLE_DEV_LOGS = true;<% } %>`;

520
pwa/node_modules/workbox-build/build/types.d.ts generated vendored Normal file
View file

@ -0,0 +1,520 @@
import { PackageJson } from 'type-fest';
import { BroadcastCacheUpdateOptions } from 'workbox-broadcast-update/BroadcastCacheUpdate';
import { GoogleAnalyticsInitializeOptions } from 'workbox-google-analytics/initialize';
import { HTTPMethod } from 'workbox-routing/utils/constants';
import { QueueOptions } from 'workbox-background-sync/Queue';
import { RouteHandler, RouteMatchCallback } from 'workbox-core/types';
import { CacheableResponseOptions } from 'workbox-cacheable-response/CacheableResponse';
import { ExpirationPluginOptions } from 'workbox-expiration/ExpirationPlugin';
import { WorkboxPlugin } from 'workbox-core/types';
export interface ManifestEntry {
integrity?: string;
revision: string | null;
url: string;
}
export type StrategyName = 'CacheFirst' | 'CacheOnly' | 'NetworkFirst' | 'NetworkOnly' | 'StaleWhileRevalidate';
export interface RuntimeCaching {
/**
* This determines how the runtime route will generate a response.
* To use one of the built-in {@link workbox-strategies}, provide its name,
* like `'NetworkFirst'`.
* Alternatively, this can be a {@link workbox-core.RouteHandler} callback
* function with custom response logic.
*/
handler: RouteHandler | StrategyName;
/**
* The HTTP method to match against. The default value of `'GET'` is normally
* sufficient, unless you explicitly need to match `'POST'`, `'PUT'`, or
* another type of request.
* @default "GET"
*/
method?: HTTPMethod;
options?: {
/**
* Configuring this will add a
* {@link workbox-background-sync.BackgroundSyncPlugin} instance to the
* {@link workbox-strategies} configured in `handler`.
*/
backgroundSync?: {
name: string;
options?: QueueOptions;
};
/**
* Configuring this will add a
* {@link workbox-broadcast-update.BroadcastUpdatePlugin} instance to the
* {@link workbox-strategies} configured in `handler`.
*/
broadcastUpdate?: {
channelName?: string;
options: BroadcastCacheUpdateOptions;
};
/**
* Configuring this will add a
* {@link workbox-cacheable-response.CacheableResponsePlugin} instance to
* the {@link workbox-strategies} configured in `handler`.
*/
cacheableResponse?: CacheableResponseOptions;
/**
* If provided, this will set the `cacheName` property of the
* {@link workbox-strategies} configured in `handler`.
*/
cacheName?: string | null;
/**
* Configuring this will add a
* {@link workbox-expiration.ExpirationPlugin} instance to
* the {@link workbox-strategies} configured in `handler`.
*/
expiration?: ExpirationPluginOptions;
/**
* If provided, this will set the `networkTimeoutSeconds` property of the
* {@link workbox-strategies} configured in `handler`. Note that only
* `'NetworkFirst'` and `'NetworkOnly'` support `networkTimeoutSeconds`.
*/
networkTimeoutSeconds?: number;
/**
* Configuring this allows the use of one or more Workbox plugins that
* don't have "shortcut" options (like `expiration` for
* {@link workbox-expiration.ExpirationPlugin}). The plugins provided here
* will be added to the {@link workbox-strategies} configured in `handler`.
*/
plugins?: Array<WorkboxPlugin>;
/**
* Configuring this will add a
* {@link workbox-precaching.PrecacheFallbackPlugin} instance to
* the {@link workbox-strategies} configured in `handler`.
*/
precacheFallback?: {
fallbackURL: string;
};
/**
* Enabling this will add a
* {@link workbox-range-requests.RangeRequestsPlugin} instance to
* the {@link workbox-strategies} configured in `handler`.
*/
rangeRequests?: boolean;
/**
* Configuring this will pass along the `fetchOptions` value to
* the {@link workbox-strategies} configured in `handler`.
*/
fetchOptions?: RequestInit;
/**
* Configuring this will pass along the `matchOptions` value to
* the {@link workbox-strategies} configured in `handler`.
*/
matchOptions?: CacheQueryOptions;
};
/**
* This match criteria determines whether the configured handler will
* generate a response for any requests that don't match one of the precached
* URLs. If multiple `RuntimeCaching` routes are defined, then the first one
* whose `urlPattern` matches will be the one that responds.
*
* This value directly maps to the first parameter passed to
* {@link workbox-routing.registerRoute}. It's recommended to use a
* {@link workbox-core.RouteMatchCallback} function for greatest flexibility.
*/
urlPattern: RegExp | string | RouteMatchCallback;
}
export interface ManifestTransformResult {
manifest: Array<ManifestEntry & {
size: number;
}>;
warnings?: Array<string>;
}
export type ManifestTransform = (manifestEntries: Array<ManifestEntry & {
size: number;
}>, compilation?: unknown) => Promise<ManifestTransformResult> | ManifestTransformResult;
export interface BasePartial {
/**
* A list of entries to be precached, in addition to any entries that are
* generated as part of the build configuration.
*/
additionalManifestEntries?: Array<string | ManifestEntry>;
/**
* Assets that match this will be assumed to be uniquely versioned via their
* URL, and exempted from the normal HTTP cache-busting that's done when
* populating the precache. While not required, it's recommended that if your
* existing build process already inserts a `[hash]` value into each filename,
* you provide a RegExp that will detect that, as it will reduce the bandwidth
* consumed when precaching.
*/
dontCacheBustURLsMatching?: RegExp;
/**
* One or more functions which will be applied sequentially against the
* generated manifest. If `modifyURLPrefix` or `dontCacheBustURLsMatching` are
* also specified, their corresponding transformations will be applied first.
*/
manifestTransforms?: Array<ManifestTransform>;
/**
* This value can be used to determine the maximum size of files that will be
* precached. This prevents you from inadvertently precaching very large files
* that might have accidentally matched one of your patterns.
* @default 2097152
*/
maximumFileSizeToCacheInBytes?: number;
/**
* An object mapping string prefixes to replacement string values. This can be
* used to, e.g., remove or add a path prefix from a manifest entry if your
* web hosting setup doesn't match your local filesystem setup. As an
* alternative with more flexibility, you can use the `manifestTransforms`
* option and provide a function that modifies the entries in the manifest
* using whatever logic you provide.
*
* Example usage:
*
* ```
* // Replace a '/dist/' prefix with '/', and also prepend
* // '/static' to every URL.
* modifyURLPrefix: {
* '/dist/': '/',
* '': '/static',
* }
* ```
*/
modifyURLPrefix?: {
[key: string]: string;
};
}
export interface GeneratePartial {
/**
* The [targets](https://babeljs.io/docs/en/babel-preset-env#targets) to pass
* to `babel-preset-env` when transpiling the service worker bundle.
* @default ["chrome >= 56"]
*/
babelPresetEnvTargets?: Array<string>;
/**
* An optional ID to be prepended to cache names. This is primarily useful for
* local development where multiple sites may be served from the same
* `http://localhost:port` origin.
*/
cacheId?: string | null;
/**
* Whether or not Workbox should attempt to identify and delete any precaches
* created by older, incompatible versions.
* @default false
*/
cleanupOutdatedCaches?: boolean;
/**
* Whether or not the service worker should [start controlling](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#clientsclaim)
* any existing clients as soon as it activates.
* @default false
*/
clientsClaim?: boolean;
/**
* If a navigation request for a URL ending in `/` fails to match a precached
* URL, this value will be appended to the URL and that will be checked for a
* precache match. This should be set to what your web server is using for its
* directory index.
*/
directoryIndex?: string | null;
/**
* @default false
*/
disableDevLogs?: boolean;
/**
* Any search parameter names that match against one of the RegExp in this
* array will be removed before looking for a precache match. This is useful
* if your users might request URLs that contain, for example, URL parameters
* used to track the source of the traffic. If not provided, the default value
* is `[/^utm_/, /^fbclid$/]`.
*
*/
ignoreURLParametersMatching?: Array<RegExp>;
/**
* A list of JavaScript files that should be passed to
* [`importScripts()`](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts)
* inside the generated service worker file. This is useful when you want to
* let Workbox create your top-level service worker file, but want to include
* some additional code, such as a push event listener.
*/
importScripts?: Array<string>;
/**
* Whether the runtime code for the Workbox library should be included in the
* top-level service worker, or split into a separate file that needs to be
* deployed alongside the service worker. Keeping the runtime separate means
* that users will not have to re-download the Workbox code each time your
* top-level service worker changes.
* @default false
*/
inlineWorkboxRuntime?: boolean;
/**
* If set to 'production', then an optimized service worker bundle that
* excludes debugging info will be produced. If not explicitly configured
* here, the `process.env.NODE_ENV` value will be used, and failing that, it
* will fall back to `'production'`.
* @default "production"
*/
mode?: string | null;
/**
* If specified, all
* [navigation requests](https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests)
* for URLs that aren't precached will be fulfilled with the HTML at the URL
* provided. You must pass in the URL of an HTML document that is listed in
* your precache manifest. This is meant to be used in a Single Page App
* scenario, in which you want all navigations to use common
* [App Shell HTML](https://developers.google.com/web/fundamentals/architecture/app-shell).
* @default null
*/
navigateFallback?: string | null;
/**
* An optional array of regular expressions that restricts which URLs the
* configured `navigateFallback` behavior applies to. This is useful if only a
* subset of your site's URLs should be treated as being part of a
* [Single Page App](https://en.wikipedia.org/wiki/Single-page_application).
* If both `navigateFallbackDenylist` and `navigateFallbackAllowlist` are
* configured, the denylist takes precedent.
*
* *Note*: These RegExps may be evaluated against every destination URL during
* a navigation. Avoid using
* [complex RegExps](https://github.com/GoogleChrome/workbox/issues/3077),
* or else your users may see delays when navigating your site.
*/
navigateFallbackAllowlist?: Array<RegExp>;
/**
* An optional array of regular expressions that restricts which URLs the
* configured `navigateFallback` behavior applies to. This is useful if only a
* subset of your site's URLs should be treated as being part of a
* [Single Page App](https://en.wikipedia.org/wiki/Single-page_application).
* If both `navigateFallbackDenylist` and `navigateFallbackAllowlist` are
* configured, the denylist takes precedence.
*
* *Note*: These RegExps may be evaluated against every destination URL during
* a navigation. Avoid using
* [complex RegExps](https://github.com/GoogleChrome/workbox/issues/3077),
* or else your users may see delays when navigating your site.
*/
navigateFallbackDenylist?: Array<RegExp>;
/**
* Whether or not to enable
* [navigation preload](https://developers.google.com/web/tools/workbox/modules/workbox-navigation-preload)
* in the generated service worker. When set to true, you must also use
* `runtimeCaching` to set up an appropriate response strategy that will match
* navigation requests, and make use of the preloaded response.
* @default false
*/
navigationPreload?: boolean;
/**
* Controls whether or not to include support for
* [offline Google Analytics](https://developers.google.com/web/tools/workbox/guides/enable-offline-analytics).
* When `true`, the call to `workbox-google-analytics`'s `initialize()` will
* be added to your generated service worker. When set to an `Object`, that
* object will be passed in to the `initialize()` call, allowing you to
* customize the behavior.
* @default false
*/
offlineGoogleAnalytics?: boolean | GoogleAnalyticsInitializeOptions;
/**
* When using Workbox's build tools to generate your service worker, you can
* specify one or more runtime caching configurations. These are then
* translated to {@link workbox-routing.registerRoute} calls using the match
* and handler configuration you define.
*
* For all of the options, see the {@link workbox-build.RuntimeCaching}
* documentation. The example below shows a typical configuration, with two
* runtime routes defined:
*
* @example
* runtimeCaching: [{
* urlPattern: ({url}) => url.origin === 'https://api.example.com',
* handler: 'NetworkFirst',
* options: {
* cacheName: 'api-cache',
* },
* }, {
* urlPattern: ({request}) => request.destination === 'image',
* handler: 'StaleWhileRevalidate',
* options: {
* cacheName: 'images-cache',
* expiration: {
* maxEntries: 10,
* },
* },
* }]
*/
runtimeCaching?: Array<RuntimeCaching>;
/**
* Whether to add an unconditional call to [`skipWaiting()`](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#skip_the_waiting_phase)
* to the generated service worker. If `false`, then a `message` listener will
* be added instead, allowing client pages to trigger `skipWaiting()` by
* calling `postMessage({type: 'SKIP_WAITING'})` on a waiting service worker.
* @default false
*/
skipWaiting?: boolean;
/**
* Whether to create a sourcemap for the generated service worker files.
* @default true
*/
sourcemap?: boolean;
}
export interface RequiredGlobDirectoryPartial {
/**
* The local directory you wish to match `globPatterns` against. The path is
* relative to the current directory.
*/
globDirectory: string;
}
export interface OptionalGlobDirectoryPartial {
/**
* The local directory you wish to match `globPatterns` against. The path is
* relative to the current directory.
*/
globDirectory?: string;
}
export interface GlobPartial {
/**
* Determines whether or not symlinks are followed when generating the
* precache manifest. For more information, see the definition of `follow` in
* the `glob` [documentation](https://github.com/isaacs/node-glob#options).
* @default true
*/
globFollow?: boolean;
/**
* A set of patterns matching files to always exclude when generating the
* precache manifest. For more information, see the definition of `ignore` in
* the `glob` [documentation](https://github.com/isaacs/node-glob#options).
* @default ["**\/node_modules\/**\/*"]
*/
globIgnores?: Array<string>;
/**
* Files matching any of these patterns will be included in the precache
* manifest. For more information, see the
* [`glob` primer](https://github.com/isaacs/node-glob#glob-primer).
* @default ["**\/*.{js,wasm,css,html}"]
*/
globPatterns?: Array<string>;
/**
* If a URL is rendered based on some server-side logic, its contents may
* depend on multiple files or on some other unique string value. The keys in
* this object are server-rendered URLs. If the values are an array of
* strings, they will be interpreted as `glob` patterns, and the contents of
* any files matching the patterns will be used to uniquely version the URL.
* If used with a single string, it will be interpreted as unique versioning
* information that you've generated for a given URL.
*/
templatedURLs?: {
[key: string]: string | Array<string>;
};
}
export interface InjectPartial {
/**
* The string to find inside of the `swSrc` file. Once found, it will be
* replaced by the generated precache manifest.
* @default "self.__WB_MANIFEST"
*/
injectionPoint?: string;
/**
* The path and filename of the service worker file that will be read during
* the build process, relative to the current working directory.
*/
swSrc: string;
}
export interface WebpackPartial {
/**
* One or more chunk names whose corresponding output files should be included
* in the precache manifest.
*/
chunks?: Array<string>;
/**
* One or more specifiers used to exclude assets from the precache manifest.
* This is interpreted following
* [the same rules](https://webpack.js.org/configuration/module/#condition)
* as `webpack`'s standard `exclude` option.
* If not provided, the default value is `[/\.map$/, /^manifest.*\.js$]`.
*/
exclude?: Array<string | RegExp | ((arg0: any) => boolean)>;
/**
* One or more chunk names whose corresponding output files should be excluded
* from the precache manifest.
*/
excludeChunks?: Array<string>;
/**
* One or more specifiers used to include assets in the precache manifest.
* This is interpreted following
* [the same rules](https://webpack.js.org/configuration/module/#condition)
* as `webpack`'s standard `include` option.
*/
include?: Array<string | RegExp | ((arg0: any) => boolean)>;
/**
* If set to 'production', then an optimized service worker bundle that
* excludes debugging info will be produced. If not explicitly configured
* here, the `mode` value configured in the current `webpack` compilation
* will be used.
*/
mode?: string | null;
}
export interface RequiredSWDestPartial {
/**
* The path and filename of the service worker file that will be created by
* the build process, relative to the current working directory. It must end
* in '.js'.
*/
swDest: string;
}
export interface WebpackGenerateSWPartial {
/**
* One or more names of webpack chunks. The content of those chunks will be
* included in the generated service worker, via a call to `importScripts()`.
*/
importScriptsViaChunks?: Array<string>;
/**
* The asset name of the service worker file created by this plugin.
* @default "service-worker.js"
*/
swDest?: string;
}
export interface WebpackInjectManifestPartial {
/**
* When `true` (the default), the `swSrc` file will be compiled by webpack.
* When `false`, compilation will not occur (and `webpackCompilationPlugins`
* can't be used.) Set to `false` if you want to inject the manifest into,
* e.g., a JSON file.
* @default true
*/
compileSrc?: boolean;
/**
* The asset name of the service worker file that will be created by this
* plugin. If omitted, the name will be based on the `swSrc` name.
*/
swDest?: string;
/**
* Optional `webpack` plugins that will be used when compiling the `swSrc`
* input file. Only valid if `compileSrc` is `true`.
*/
webpackCompilationPlugins?: Array<any>;
}
export type GenerateSWOptions = BasePartial & GlobPartial & GeneratePartial & RequiredSWDestPartial & OptionalGlobDirectoryPartial;
export type GetManifestOptions = BasePartial & GlobPartial & RequiredGlobDirectoryPartial;
export type InjectManifestOptions = BasePartial & GlobPartial & InjectPartial & RequiredSWDestPartial & RequiredGlobDirectoryPartial;
export type WebpackGenerateSWOptions = BasePartial & WebpackPartial & GeneratePartial & WebpackGenerateSWPartial;
export type WebpackInjectManifestOptions = BasePartial & WebpackPartial & InjectPartial & WebpackInjectManifestPartial;
export interface GetManifestResult {
count: number;
manifestEntries: Array<ManifestEntry>;
size: number;
warnings: Array<string>;
}
export type BuildResult = Omit<GetManifestResult, 'manifestEntries'> & {
filePaths: Array<string>;
};
/**
* @private
*/
export interface FileDetails {
file: string;
hash: string;
size: number;
}
/**
* @private
*/
export type BuildType = 'dev' | 'prod';
/**
* @private
*/
export interface WorkboxPackageJSON extends PackageJson {
workbox?: {
browserNamespace?: string;
packageType?: string;
prodOnly?: boolean;
};
}

2
pwa/node_modules/workbox-build/build/types.js generated vendored Normal file
View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

1
pwa/node_modules/workbox-build/node_modules/.bin/rollup generated vendored Symbolic link
View file

@ -0,0 +1 @@
../rollup/dist/bin/rollup

View file

@ -0,0 +1,127 @@
declare namespace prettyBytes {
interface Options {
/**
Include plus sign for positive numbers. If the difference is exactly zero a space character will be prepended instead for better alignment.
@default false
*/
readonly signed?: boolean;
/**
- If `false`: Output won't be localized.
- If `true`: Localize the output using the system/browser locale.
- If `string`: Expects a [BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) (For example: `en`, `de`, …)
- If `string[]`: Expects a list of [BCP 47 language tags](https://en.wikipedia.org/wiki/IETF_language_tag) (For example: `en`, `de`, …)
__Note:__ Localization should generally work in browsers. Node.js needs to be [built](https://github.com/nodejs/node/wiki/Intl) with `full-icu` or `system-icu`. Alternatively, the [`full-icu`](https://github.com/unicode-org/full-icu-npm) module can be used to provide support at runtime.
@default false
*/
readonly locale?: boolean | string | readonly string[];
/**
Format the number as [bits](https://en.wikipedia.org/wiki/Bit) instead of [bytes](https://en.wikipedia.org/wiki/Byte). This can be useful when, for example, referring to [bit rate](https://en.wikipedia.org/wiki/Bit_rate).
@default false
@example
```
import prettyBytes = require('pretty-bytes');
prettyBytes(1337, {bits: true});
//=> '1.34 kbit'
```
*/
readonly bits?: boolean;
/**
Format the number using the [Binary Prefix](https://en.wikipedia.org/wiki/Binary_prefix) instead of the [SI Prefix](https://en.wikipedia.org/wiki/SI_prefix). This can be useful for presenting memory amounts. However, this should not be used for presenting file sizes.
@default false
@example
```
import prettyBytes = require('pretty-bytes');
prettyBytes(1000, {binary: true});
//=> '1000 bit'
prettyBytes(1024, {binary: true});
//=> '1 kiB'
```
*/
readonly binary?: boolean;
/**
The minimum number of fraction digits to display.
If neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.
@default undefined
```
import prettyBytes = require('pretty-bytes');
// Show the number with at least 3 fractional digits
prettyBytes(1900, {minimumFractionDigits: 3});
//=> '1.900 kB'
prettyBytes(1900);
//=> '1.9 kB'
```
*/
readonly minimumFractionDigits?: number;
/**
The maximum number of fraction digits to display.
If neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.
@default undefined
```
import prettyBytes = require('pretty-bytes');
// Show the number with at most 1 fractional digit
prettyBytes(1920, {maximumFractionDigits: 1});
//=> '1.9 kB'
prettyBytes(1920);
//=> '1.92 kB'
```
*/
readonly maximumFractionDigits?: number;
}
}
/**
Convert bytes to a human readable string: `1337` `1.34 kB`.
@param number - The number to format.
@example
```
import prettyBytes = require('pretty-bytes');
prettyBytes(1337);
//=> '1.34 kB'
prettyBytes(100);
//=> '100 B'
// Display file size differences
prettyBytes(42, {signed: true});
//=> '+42 B'
// Localized output using German locale
prettyBytes(1337, {locale: 'de'});
//=> '1,34 kB'
```
*/
declare function prettyBytes(
number: number,
options?: prettyBytes.Options
): string;
export = prettyBytes;

View file

@ -0,0 +1,118 @@
'use strict';
const BYTE_UNITS = [
'B',
'kB',
'MB',
'GB',
'TB',
'PB',
'EB',
'ZB',
'YB'
];
const BIBYTE_UNITS = [
'B',
'kiB',
'MiB',
'GiB',
'TiB',
'PiB',
'EiB',
'ZiB',
'YiB'
];
const BIT_UNITS = [
'b',
'kbit',
'Mbit',
'Gbit',
'Tbit',
'Pbit',
'Ebit',
'Zbit',
'Ybit'
];
const BIBIT_UNITS = [
'b',
'kibit',
'Mibit',
'Gibit',
'Tibit',
'Pibit',
'Eibit',
'Zibit',
'Yibit'
];
/*
Formats the given number using `Number#toLocaleString`.
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
- If locale is true, the system default locale is used for translation.
- If no value for locale is specified, the number is returned unmodified.
*/
const toLocaleString = (number, locale, options) => {
let result = number;
if (typeof locale === 'string' || Array.isArray(locale)) {
result = number.toLocaleString(locale, options);
} else if (locale === true || options !== undefined) {
result = number.toLocaleString(undefined, options);
}
return result;
};
module.exports = (number, options) => {
if (!Number.isFinite(number)) {
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
}
options = Object.assign({bits: false, binary: false}, options);
const UNITS = options.bits ?
(options.binary ? BIBIT_UNITS : BIT_UNITS) :
(options.binary ? BIBYTE_UNITS : BYTE_UNITS);
if (options.signed && number === 0) {
return ` 0 ${UNITS[0]}`;
}
const isNegative = number < 0;
const prefix = isNegative ? '-' : (options.signed ? '+' : '');
if (isNegative) {
number = -number;
}
let localeOptions;
if (options.minimumFractionDigits !== undefined) {
localeOptions = {minimumFractionDigits: options.minimumFractionDigits};
}
if (options.maximumFractionDigits !== undefined) {
localeOptions = Object.assign({maximumFractionDigits: options.maximumFractionDigits}, localeOptions);
}
if (number < 1) {
const numberString = toLocaleString(number, options.locale, localeOptions);
return prefix + numberString + ' ' + UNITS[0];
}
const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
// eslint-disable-next-line unicorn/prefer-exponentiation-operator
number /= Math.pow(options.binary ? 1024 : 1000, exponent);
if (!localeOptions) {
number = number.toPrecision(3);
}
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
const unit = UNITS[exponent];
return prefix + numberString + ' ' + unit;
};

View file

@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,44 @@
{
"name": "pretty-bytes",
"version": "5.6.0",
"description": "Convert bytes to a human readable string: 1337 → 1.34 kB",
"license": "MIT",
"repository": "sindresorhus/pretty-bytes",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"pretty",
"bytes",
"byte",
"filesize",
"size",
"file",
"human",
"humanized",
"readable",
"si",
"data",
"locale",
"localization",
"localized"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}

View file

@ -0,0 +1,131 @@
# pretty-bytes
> Convert bytes to a human readable string: `1337``1.34 kB`
Useful for displaying file sizes for humans.
*Note that it uses base-10 (e.g. kilobyte).
[Read about the difference between kilobyte and kibibyte.](https://web.archive.org/web/20150324153922/https://pacoup.com/2009/05/26/kb-kb-kib-whats-up-with-that/)*
## Install
```
$ npm install pretty-bytes
```
## Usage
```js
const prettyBytes = require('pretty-bytes');
prettyBytes(1337);
//=> '1.34 kB'
prettyBytes(100);
//=> '100 B'
// Display with units of bits
prettyBytes(1337, {bits: true});
//=> '1.34 kbit'
// Display file size differences
prettyBytes(42, {signed: true});
//=> '+42 B'
// Localized output using German locale
prettyBytes(1337, {locale: 'de'});
//=> '1,34 kB'
```
## API
### prettyBytes(number, options?)
#### number
Type: `number`
The number to format.
#### options
Type: `object`
##### signed
Type: `boolean`\
Default: `false`
Include plus sign for positive numbers. If the difference is exactly zero a space character will be prepended instead for better alignment.
##### bits
Type: `boolean`\
Default: `false`
Format the number as [bits](https://en.wikipedia.org/wiki/Bit) instead of [bytes](https://en.wikipedia.org/wiki/Byte). This can be useful when, for example, referring to [bit rate](https://en.wikipedia.org/wiki/Bit_rate).
##### binary
Type: `boolean`\
Default: `false`
Format the number using the [Binary Prefix](https://en.wikipedia.org/wiki/Binary_prefix) instead of the [SI Prefix](https://en.wikipedia.org/wiki/SI_prefix). This can be useful for presenting memory amounts. However, this should not be used for presenting file sizes.
##### locale
Type: `boolean | string`\
Default: `false` *(No localization)*
**Important:** Only the number and decimal separator are localized. The unit title is not and will not be localized.
- If `true`: Localize the output using the system/browser locale.
- If `string`: Expects a [BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) (For example: `en`, `de`, …)
- If `string[]`: Expects a list of [BCP 47 language tags](https://en.wikipedia.org/wiki/IETF_language_tag) (For example: `en`, `de`, …)
**Note:** Localization should generally work in browsers. Node.js needs to be [built](https://github.com/nodejs/node/wiki/Intl) with `full-icu` or `system-icu`. Alternatively, the [`full-icu`](https://github.com/unicode-org/full-icu-npm) module can be used to provide support at runtime. [Node.js 13](https://nodejs.org/en/blog/release/v13.0.0/) and later ships with ICU by default.
##### minimumFractionDigits
Type: `number`\
Default: `undefined`
The minimum number of fraction digits to display.
If neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.
```js
const prettyBytes = require('pretty-bytes');
// Show the number with at least 3 fractional digits
prettyBytes(1900, {minimumFractionDigits: 3});
//=> '1.900 kB'
prettyBytes(1900);
//=> '1.9 kB'
```
##### maximumFractionDigits
Type: `number`\
Default: `undefined`
The maximum number of fraction digits to display.
If neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.
```js
const prettyBytes = require('pretty-bytes');
// Show the number with at most 1 fractional digit
prettyBytes(1920, {maximumFractionDigits: 1});
//=> '1.9 kB'
prettyBytes(1920);
//=> '1.92 kB'
```
## Related
- [pretty-bytes-cli](https://github.com/sindresorhus/pretty-bytes-cli) - CLI for this module
- [pretty-ms](https://github.com/sindresorhus/pretty-ms) - Convert milliseconds to a human readable string

View file

@ -0,0 +1,703 @@
# Rollup core license
Rollup is released under the MIT license:
The MIT License (MIT)
Copyright (c) 2017 [these people](https://github.com/rollup/rollup/graphs/contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Licenses of bundled dependencies
The published Rollup artifact additionally contains code with the following licenses:
MIT, ISC
# Bundled dependencies:
## @rollup/pluginutils
License: MIT
By: Rich Harris
Repository: rollup/plugins
---------------------------------------
## acorn
License: MIT
By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine
Repository: https://github.com/acornjs/acorn.git
> MIT License
>
> Copyright (C) 2012-2022 by various contributors (see AUTHORS)
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
---------------------------------------
## acorn-walk
License: MIT
By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine
Repository: https://github.com/acornjs/acorn.git
> MIT License
>
> Copyright (C) 2012-2020 by various contributors (see AUTHORS)
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
---------------------------------------
## anymatch
License: ISC
By: Elan Shanker
Repository: https://github.com/micromatch/anymatch
> The ISC License
>
> Copyright (c) 2019 Elan Shanker, Paul Miller (https://paulmillr.com)
>
> Permission to use, copy, modify, and/or distribute this software for any
> purpose with or without fee is hereby granted, provided that the above
> copyright notice and this permission notice appear in all copies.
>
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
---------------------------------------
## binary-extensions
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/binary-extensions
> MIT License
>
> Copyright (c) 2019 Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com), Paul Miller (https://paulmillr.com)
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---------------------------------------
## braces
License: MIT
By: Jon Schlinkert, Brian Woodward, Elan Shanker, Eugene Sharygin, hemanth.hm
Repository: micromatch/braces
> The MIT License (MIT)
>
> Copyright (c) 2014-2018, Jon Schlinkert.
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
---------------------------------------
## chokidar
License: MIT
By: Paul Miller, Elan Shanker
Repository: git+https://github.com/paulmillr/chokidar.git
> The MIT License (MIT)
>
> Copyright (c) 2012-2019 Paul Miller (https://paulmillr.com), Elan Shanker
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the “Software”), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
---------------------------------------
## colorette
License: MIT
By: Jorge Bucaran
Repository: jorgebucaran/colorette
> Copyright © Jorge Bucaran <<https://jorgebucaran.com>>
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---------------------------------------
## date-time
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/date-time
> MIT License
>
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---------------------------------------
## fill-range
License: MIT
By: Jon Schlinkert, Edo Rivai, Paul Miller, Rouven Weßling
Repository: jonschlinkert/fill-range
> The MIT License (MIT)
>
> Copyright (c) 2014-present, Jon Schlinkert.
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
---------------------------------------
## glob-parent
License: ISC
By: Gulp Team, Elan Shanker, Blaine Bublitz
Repository: gulpjs/glob-parent
> The ISC License
>
> Copyright (c) 2015, 2019 Elan Shanker
>
> Permission to use, copy, modify, and/or distribute this software for any
> purpose with or without fee is hereby granted, provided that the above
> copyright notice and this permission notice appear in all copies.
>
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
---------------------------------------
## hash.js
License: MIT
By: Fedor Indutny
Repository: git@github.com:indutny/hash.js
---------------------------------------
## inherits
License: ISC
Repository: git://github.com/isaacs/inherits
> The ISC License
>
> Copyright (c) Isaac Z. Schlueter
>
> Permission to use, copy, modify, and/or distribute this software for any
> purpose with or without fee is hereby granted, provided that the above
> copyright notice and this permission notice appear in all copies.
>
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
> FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
> LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
> OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
> PERFORMANCE OF THIS SOFTWARE.
---------------------------------------
## is-binary-path
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/is-binary-path
> MIT License
>
> Copyright (c) 2019 Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com), Paul Miller (https://paulmillr.com)
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---------------------------------------
## is-extglob
License: MIT
By: Jon Schlinkert
Repository: jonschlinkert/is-extglob
> The MIT License (MIT)
>
> Copyright (c) 2014-2016, Jon Schlinkert
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
---------------------------------------
## is-glob
License: MIT
By: Jon Schlinkert, Brian Woodward, Daniel Perez
Repository: micromatch/is-glob
> The MIT License (MIT)
>
> Copyright (c) 2014-2017, Jon Schlinkert.
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
---------------------------------------
## is-number
License: MIT
By: Jon Schlinkert, Olsten Larck, Rouven Weßling
Repository: jonschlinkert/is-number
> The MIT License (MIT)
>
> Copyright (c) 2014-present, Jon Schlinkert.
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
---------------------------------------
## is-reference
License: MIT
By: Rich Harris
Repository: git+https://github.com/Rich-Harris/is-reference.git
---------------------------------------
## locate-character
License: MIT
By: Rich Harris
Repository: Rich-Harris/locate-character
---------------------------------------
## magic-string
License: MIT
By: Rich Harris
Repository: https://github.com/rich-harris/magic-string
> Copyright 2018 Rich Harris
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---------------------------------------
## minimalistic-assert
License: ISC
Repository: https://github.com/calvinmetcalf/minimalistic-assert.git
> Copyright 2015 Calvin Metcalf
>
> Permission to use, copy, modify, and/or distribute this software for any purpose
> with or without fee is hereby granted, provided that the above copyright notice
> and this permission notice appear in all copies.
>
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
> FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
> LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
> OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
> PERFORMANCE OF THIS SOFTWARE.
---------------------------------------
## normalize-path
License: MIT
By: Jon Schlinkert, Blaine Bublitz
Repository: jonschlinkert/normalize-path
> The MIT License (MIT)
>
> Copyright (c) 2014-2018, Jon Schlinkert.
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
---------------------------------------
## parse-ms
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/parse-ms
> MIT License
>
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---------------------------------------
## picomatch
License: MIT
By: Jon Schlinkert
Repository: micromatch/picomatch
> The MIT License (MIT)
>
> Copyright (c) 2017-present, Jon Schlinkert.
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
---------------------------------------
## pretty-bytes
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/pretty-bytes
> MIT License
>
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---------------------------------------
## pretty-ms
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/pretty-ms
> MIT License
>
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---------------------------------------
## readdirp
License: MIT
By: Thorsten Lorenz, Paul Miller
Repository: git://github.com/paulmillr/readdirp.git
> MIT License
>
> Copyright (c) 2012-2019 Thorsten Lorenz, Paul Miller (https://paulmillr.com)
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all
> copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.
---------------------------------------
## signal-exit
License: ISC
By: Ben Coe
Repository: https://github.com/tapjs/signal-exit.git
> The ISC License
>
> Copyright (c) 2015, Contributors
>
> Permission to use, copy, modify, and/or distribute this software
> for any purpose with or without fee is hereby granted, provided
> that the above copyright notice and this permission notice
> appear in all copies.
>
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
> OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
> LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
> OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
> WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
> ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
---------------------------------------
## sourcemap-codec
License: MIT
By: Rich Harris
Repository: https://github.com/Rich-Harris/sourcemap-codec
> The MIT License
>
> Copyright (c) 2015 Rich Harris
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
---------------------------------------
## time-zone
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/time-zone
> MIT License
>
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---------------------------------------
## to-regex-range
License: MIT
By: Jon Schlinkert, Rouven Weßling
Repository: micromatch/to-regex-range
> The MIT License (MIT)
>
> Copyright (c) 2015-present, Jon Schlinkert.
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
---------------------------------------
## yargs-parser
License: ISC
By: Ben Coe
Repository: https://github.com/yargs/yargs-parser.git
> Copyright (c) 2016, Contributors
>
> Permission to use, copy, modify, and/or distribute this software
> for any purpose with or without fee is hereby granted, provided
> that the above copyright notice and this permission notice
> appear in all copies.
>
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
> OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
> LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
> OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
> WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
> ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View file

@ -0,0 +1,125 @@
<p align="center">
<a href="https://rollupjs.org/"><img src="https://rollupjs.org/logo.svg" width="150" /></a>
</p>
<p align="center">
<a href="https://www.npmjs.com/package/rollup">
<img src="https://img.shields.io/npm/v/rollup.svg" alt="npm version" >
</a>
<a href="https://packagephobia.now.sh/result?p=rollup">
<img src="https://packagephobia.now.sh/badge?p=rollup" alt="install size" >
</a>
<a href="https://codecov.io/gh/rollup/rollup">
<img src="https://codecov.io/gh/rollup/rollup/graph/badge.svg" alt="code coverage" >
</a>
<a href="#backers" alt="sponsors on Open Collective">
<img src="https://opencollective.com/rollup/backers/badge.svg" alt="backers" >
</a>
<a href="#sponsors" alt="Sponsors on Open Collective">
<img src="https://opencollective.com/rollup/sponsors/badge.svg" alt="sponsors" >
</a>
<a href="https://github.com/rollup/rollup/blob/master/LICENSE.md">
<img src="https://img.shields.io/npm/l/rollup.svg" alt="license">
</a>
<a href='https://is.gd/rollup_chat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge'>
<img src='https://img.shields.io/discord/466787075518365708?color=778cd1&label=chat' alt='Join the chat at https://is.gd/rollup_chat'>
</a>
</p>
<h1 align="center">Rollup</h1>
## Overview
Rollup is a module bundler for JavaScript which compiles small pieces of code into something larger and more complex, such as a library or application. It uses the standardized ES module format for code, instead of previous idiosyncratic solutions such as CommonJS and AMD. ES modules let you freely and seamlessly combine the most useful individual functions from your favorite libraries. Rollup can optimize ES modules for faster native loading in modern browsers, or output a legacy module format allowing ES module workflows today.
## Quick Start Guide
Install with `npm install --global rollup`. Rollup can be used either through a [command line interface](https://rollupjs.org/#command-line-reference) with an optional configuration file or else through its [JavaScript API](https://rollupjs.org/guide/en/#javascript-api). Run `rollup --help` to see the available options and parameters. The starter project templates, [rollup-starter-lib](https://github.com/rollup/rollup-starter-lib) and [rollup-starter-app](https://github.com/rollup/rollup-starter-app), demonstrate common configuration options, and more detailed instructions are available throughout the [user guide](https://rollupjs.org/).
### Commands
These commands assume the entry point to your application is named main.js, and that you'd like all imports compiled into a single file named bundle.js.
For browsers:
```bash
# compile to a <script> containing a self-executing function
rollup main.js --format iife --name "myBundle" --file bundle.js
```
For Node.js:
```bash
# compile to a CommonJS module
rollup main.js --format cjs --file bundle.js
```
For both browsers and Node.js:
```bash
# UMD format requires a bundle name
rollup main.js --format umd --name "myBundle" --file bundle.js
```
## Why
Developing software is usually easier if you break your project into smaller separate pieces, since that often removes unexpected interactions and dramatically reduces the complexity of the problems you'll need to solve, and simply writing smaller projects in the first place [isn't necessarily the answer](https://medium.com/@Rich_Harris/small-modules-it-s-not-quite-that-simple-3ca532d65de4). Unfortunately, JavaScript has not historically included this capability as a core feature in the language.
This finally changed with ES modules support in JavaScript, which provides a syntax for importing and exporting functions and data so they can be shared between separate scripts. Most browsers and Node.js support ES modules. However, Node.js releases before 12.17 support ES modules only behind the `--experimental-modules` flag, and older browsers like Internet Explorer do not support ES modules at all. Rollup allows you to write your code using ES modules, and run your application even in environments that do not support ES modules natively. For environments that support them, Rollup can output optimized ES modules; for environments that don't, Rollup can compile your code to other formats such as CommonJS modules, AMD modules, and IIFE-style scripts. This means that you get to _write future-proof code_, and you also get the tremendous benefits of...
## Tree Shaking
In addition to enabling the use of ES modules, Rollup also statically analyzes and optimizes the code you are importing, and will exclude anything that isn't actually used. This allows you to build on top of existing tools and modules without adding extra dependencies or bloating the size of your project.
For example, with CommonJS, the _entire tool or library must be imported_.
```js
// import the entire utils object with CommonJS
var utils = require('utils');
var query = 'Rollup';
// use the ajax method of the utils object
utils.ajax('https://api.example.com?search=' + query).then(handleResponse);
```
But with ES modules, instead of importing the whole `utils` object, we can just import the one `ajax` function we need:
```js
// import the ajax function with an ES import statement
import { ajax } from 'utils';
var query = 'Rollup';
// call the ajax function
ajax('https://api.example.com?search=' + query).then(handleResponse);
```
Because Rollup includes the bare minimum, it results in lighter, faster, and less complicated libraries and applications. Since this approach is based on explicit `import` and `export` statements, it is vastly more effective than simply running an automated minifier to detect unused variables in the compiled output code.
## Compatibility
### Importing CommonJS
Rollup can import existing CommonJS modules [through a plugin](https://github.com/rollup/plugins/tree/master/packages/commonjs).
### Publishing ES Modules
To make sure your ES modules are immediately usable by tools that work with CommonJS such as Node.js and webpack, you can use Rollup to compile to UMD or CommonJS format, and then point to that compiled version with the `main` property in your `package.json` file. If your `package.json` file also has a `module` field, ES-module-aware tools like Rollup and [webpack](https://webpack.js.org/) will [import the ES module version](https://github.com/rollup/rollup/wiki/pkg.module) directly.
## Contributors
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. <a href="https://github.com/rollup/rollup/graphs/contributors"><img src="https://opencollective.com/rollup/contributors.svg?width=890" /></a>
## Backers
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/rollup#backer)]
<a href="https://opencollective.com/rollup#backers" target="_blank"><img src="https://opencollective.com/rollup/backers.svg?width=890"></a>
## Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/rollup#sponsor)]
<a href="https://opencollective.com/rollup/sponsor/0/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/0/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/1/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/1/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/2/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/2/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/3/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/3/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/4/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/4/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/5/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/5/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/6/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/6/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/7/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/7/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/8/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/8/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/9/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/9/avatar.svg"></a>
## License
[MIT](https://github.com/rollup/rollup/blob/master/LICENSE.md)

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
{"type":"module"}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,16 @@
/*
@license
Rollup.js v2.80.0
Sun, 22 Feb 2026 06:16:40 GMT - commit d17ae15336a45c3c59b2a4aacac2b14186035d28
https://github.com/rollup/rollup
Released under the MIT License.
*/
export { version as VERSION, defineConfig, rollup, watch } from './shared/rollup.js';
import 'path';
import 'process';
import 'perf_hooks';
import 'crypto';
import 'fs';
import 'events';

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,27 @@
/*
@license
Rollup.js v2.80.0
Sun, 22 Feb 2026 06:16:40 GMT - commit d17ae15336a45c3c59b2a4aacac2b14186035d28
https://github.com/rollup/rollup
Released under the MIT License.
*/
'use strict';
require('path');
require('process');
require('url');
const loadConfigFile_js = require('./shared/loadConfigFile.js');
require('./shared/rollup.js');
require('./shared/mergeOptions.js');
require('tty');
require('perf_hooks');
require('crypto');
require('fs');
require('events');
module.exports = loadConfigFile_js.loadAndParseConfigFile;
//# sourceMappingURL=loadConfigFile.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,940 @@
export const VERSION: string;
export interface RollupError extends RollupLogProps {
parserError?: Error;
stack?: string;
watchFiles?: string[];
}
export interface RollupWarning extends RollupLogProps {
chunkName?: string;
cycle?: string[];
exportName?: string;
exporter?: string;
guess?: string;
importer?: string;
missing?: string;
modules?: string[];
names?: string[];
reexporter?: string;
source?: string;
sources?: string[];
}
export interface RollupLogProps {
code?: string;
frame?: string;
hook?: string;
id?: string;
loc?: {
column: number;
file?: string;
line: number;
};
message: string;
name?: string;
plugin?: string;
pluginCode?: string;
pos?: number;
url?: string;
}
export type SourceMapSegment =
| [number]
| [number, number, number, number]
| [number, number, number, number, number];
export interface ExistingDecodedSourceMap {
file?: string;
mappings: SourceMapSegment[][];
names: string[];
sourceRoot?: string;
sources: string[];
sourcesContent?: string[];
version: number;
}
export interface ExistingRawSourceMap {
file?: string;
mappings: string;
names: string[];
sourceRoot?: string;
sources: string[];
sourcesContent?: string[];
version: number;
}
export type DecodedSourceMapOrMissing =
| {
mappings?: never;
missing: true;
plugin: string;
}
| ExistingDecodedSourceMap;
export interface SourceMap {
file: string;
mappings: string;
names: string[];
sources: string[];
sourcesContent: string[];
version: number;
toString(): string;
toUrl(): string;
}
export type SourceMapInput = ExistingRawSourceMap | string | null | { mappings: '' };
type PartialNull<T> = {
[P in keyof T]: T[P] | null;
};
interface ModuleOptions {
meta: CustomPluginOptions;
moduleSideEffects: boolean | 'no-treeshake';
syntheticNamedExports: boolean | string;
}
export interface SourceDescription extends Partial<PartialNull<ModuleOptions>> {
ast?: AcornNode;
code: string;
map?: SourceMapInput;
}
export interface TransformModuleJSON {
ast?: AcornNode;
code: string;
// note if plugins use new this.cache to opt-out auto transform cache
customTransformCache: boolean;
originalCode: string;
originalSourcemap: ExistingDecodedSourceMap | null;
sourcemapChain: DecodedSourceMapOrMissing[];
transformDependencies: string[];
}
export interface ModuleJSON extends TransformModuleJSON, ModuleOptions {
ast: AcornNode;
dependencies: string[];
id: string;
resolvedIds: ResolvedIdMap;
transformFiles: EmittedFile[] | undefined;
}
export interface PluginCache {
delete(id: string): boolean;
get<T = any>(id: string): T;
has(id: string): boolean;
set<T = any>(id: string, value: T): void;
}
export interface MinimalPluginContext {
meta: PluginContextMeta;
}
export interface EmittedAsset {
fileName?: string;
name?: string;
source?: string | Uint8Array;
type: 'asset';
}
export interface EmittedChunk {
fileName?: string;
id: string;
implicitlyLoadedAfterOneOf?: string[];
importer?: string;
name?: string;
preserveSignature?: PreserveEntrySignaturesOption;
type: 'chunk';
}
export type EmittedFile = EmittedAsset | EmittedChunk;
export type EmitAsset = (name: string, source?: string | Uint8Array) => string;
export type EmitChunk = (id: string, options?: { name?: string }) => string;
export type EmitFile = (emittedFile: EmittedFile) => string;
interface ModuleInfo extends ModuleOptions {
ast: AcornNode | null;
code: string | null;
dynamicImporters: readonly string[];
dynamicallyImportedIdResolutions: readonly ResolvedId[];
dynamicallyImportedIds: readonly string[];
hasDefaultExport: boolean | null;
/** @deprecated Use `moduleSideEffects` instead */
hasModuleSideEffects: boolean | 'no-treeshake';
id: string;
implicitlyLoadedAfterOneOf: readonly string[];
implicitlyLoadedBefore: readonly string[];
importedIdResolutions: readonly ResolvedId[];
importedIds: readonly string[];
importers: readonly string[];
isEntry: boolean;
isExternal: boolean;
isIncluded: boolean | null;
}
export type GetModuleInfo = (moduleId: string) => ModuleInfo | null;
export interface CustomPluginOptions {
[plugin: string]: any;
}
export interface PluginContext extends MinimalPluginContext {
addWatchFile: (id: string) => void;
cache: PluginCache;
/** @deprecated Use `this.emitFile` instead */
emitAsset: EmitAsset;
/** @deprecated Use `this.emitFile` instead */
emitChunk: EmitChunk;
emitFile: EmitFile;
error: (err: RollupError | string, pos?: number | { column: number; line: number }) => never;
/** @deprecated Use `this.getFileName` instead */
getAssetFileName: (assetReferenceId: string) => string;
/** @deprecated Use `this.getFileName` instead */
getChunkFileName: (chunkReferenceId: string) => string;
getFileName: (fileReferenceId: string) => string;
getModuleIds: () => IterableIterator<string>;
getModuleInfo: GetModuleInfo;
getWatchFiles: () => string[];
/** @deprecated Use `this.resolve` instead */
isExternal: IsExternal;
load: (
options: { id: string; resolveDependencies?: boolean } & Partial<PartialNull<ModuleOptions>>
) => Promise<ModuleInfo>;
/** @deprecated Use `this.getModuleIds` instead */
moduleIds: IterableIterator<string>;
parse: (input: string, options?: any) => AcornNode;
resolve: (
source: string,
importer?: string,
options?: { custom?: CustomPluginOptions; isEntry?: boolean; skipSelf?: boolean }
) => Promise<ResolvedId | null>;
/** @deprecated Use `this.resolve` instead */
resolveId: (source: string, importer?: string) => Promise<string | null>;
setAssetSource: (assetReferenceId: string, source: string | Uint8Array) => void;
warn: (warning: RollupWarning | string, pos?: number | { column: number; line: number }) => void;
}
export interface PluginContextMeta {
rollupVersion: string;
watchMode: boolean;
}
export interface ResolvedId extends ModuleOptions {
external: boolean | 'absolute';
id: string;
}
export interface ResolvedIdMap {
[key: string]: ResolvedId;
}
interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
external?: boolean | 'absolute' | 'relative';
id: string;
}
export type ResolveIdResult = string | false | null | void | PartialResolvedId;
export type ResolveIdHook = (
this: PluginContext,
source: string,
importer: string | undefined,
options: { custom?: CustomPluginOptions; isEntry: boolean }
) => ResolveIdResult;
export type ShouldTransformCachedModuleHook = (
this: PluginContext,
options: {
ast: AcornNode;
code: string;
id: string;
meta: CustomPluginOptions;
moduleSideEffects: boolean | 'no-treeshake';
resolvedSources: ResolvedIdMap;
syntheticNamedExports: boolean | string;
}
) => boolean;
export type IsExternal = (
source: string,
importer: string | undefined,
isResolved: boolean
) => boolean;
export type IsPureModule = (id: string) => boolean | null | void;
export type HasModuleSideEffects = (id: string, external: boolean) => boolean;
export type LoadResult = SourceDescription | string | null | void;
export type LoadHook = (this: PluginContext, id: string) => LoadResult;
export interface TransformPluginContext extends PluginContext {
getCombinedSourcemap: () => SourceMap;
}
export type TransformResult = string | null | void | Partial<SourceDescription>;
export type TransformHook = (
this: TransformPluginContext,
code: string,
id: string
) => TransformResult;
export type ModuleParsedHook = (this: PluginContext, info: ModuleInfo) => void;
export type RenderChunkHook = (
this: PluginContext,
code: string,
chunk: RenderedChunk,
options: NormalizedOutputOptions
) => { code: string; map?: SourceMapInput } | string | null | undefined;
export type ResolveDynamicImportHook = (
this: PluginContext,
specifier: string | AcornNode,
importer: string
) => ResolveIdResult;
export type ResolveImportMetaHook = (
this: PluginContext,
prop: string | null,
options: { chunkId: string; format: InternalModuleFormat; moduleId: string }
) => string | null | void;
export type ResolveAssetUrlHook = (
this: PluginContext,
options: {
assetFileName: string;
chunkId: string;
format: InternalModuleFormat;
moduleId: string;
relativeAssetPath: string;
}
) => string | null | void;
export type ResolveFileUrlHook = (
this: PluginContext,
options: {
assetReferenceId: string | null;
chunkId: string;
chunkReferenceId: string | null;
fileName: string;
format: InternalModuleFormat;
moduleId: string;
referenceId: string;
relativePath: string;
}
) => string | null | void;
export type AddonHookFunction = (this: PluginContext) => string | Promise<string>;
export type AddonHook = string | AddonHookFunction;
export type ChangeEvent = 'create' | 'update' | 'delete';
export type WatchChangeHook = (
this: PluginContext,
id: string,
change: { event: ChangeEvent }
) => void;
/**
* use this type for plugin annotation
* @example
* ```ts
* interface Options {
* ...
* }
* const myPlugin: PluginImpl<Options> = (options = {}) => { ... }
* ```
*/
// eslint-disable-next-line @typescript-eslint/ban-types
export type PluginImpl<O extends object = object> = (options?: O) => Plugin;
export interface OutputBundle {
[fileName: string]: OutputAsset | OutputChunk;
}
export interface FunctionPluginHooks {
augmentChunkHash: (this: PluginContext, chunk: PreRenderedChunk) => string | void;
buildEnd: (this: PluginContext, err?: Error) => void;
buildStart: (this: PluginContext, options: NormalizedInputOptions) => void;
closeBundle: (this: PluginContext) => void;
closeWatcher: (this: PluginContext) => void;
generateBundle: (
this: PluginContext,
options: NormalizedOutputOptions,
bundle: OutputBundle,
isWrite: boolean
) => void;
load: LoadHook;
moduleParsed: ModuleParsedHook;
options: (this: MinimalPluginContext, options: InputOptions) => InputOptions | null | void;
outputOptions: (this: PluginContext, options: OutputOptions) => OutputOptions | null | void;
renderChunk: RenderChunkHook;
renderDynamicImport: (
this: PluginContext,
options: {
customResolution: string | null;
format: InternalModuleFormat;
moduleId: string;
targetModuleId: string | null;
}
) => { left: string; right: string } | null | void;
renderError: (this: PluginContext, err?: Error) => void;
renderStart: (
this: PluginContext,
outputOptions: NormalizedOutputOptions,
inputOptions: NormalizedInputOptions
) => void;
/** @deprecated Use `resolveFileUrl` instead */
resolveAssetUrl: ResolveAssetUrlHook;
resolveDynamicImport: ResolveDynamicImportHook;
resolveFileUrl: ResolveFileUrlHook;
resolveId: ResolveIdHook;
resolveImportMeta: ResolveImportMetaHook;
shouldTransformCachedModule: ShouldTransformCachedModuleHook;
transform: TransformHook;
watchChange: WatchChangeHook;
writeBundle: (
this: PluginContext,
options: NormalizedOutputOptions,
bundle: OutputBundle
) => void;
}
export type OutputPluginHooks =
| 'augmentChunkHash'
| 'generateBundle'
| 'outputOptions'
| 'renderChunk'
| 'renderDynamicImport'
| 'renderError'
| 'renderStart'
| 'resolveAssetUrl'
| 'resolveFileUrl'
| 'resolveImportMeta'
| 'writeBundle';
export type InputPluginHooks = Exclude<keyof FunctionPluginHooks, OutputPluginHooks>;
export type SyncPluginHooks =
| 'augmentChunkHash'
| 'outputOptions'
| 'renderDynamicImport'
| 'resolveAssetUrl'
| 'resolveFileUrl'
| 'resolveImportMeta';
export type AsyncPluginHooks = Exclude<keyof FunctionPluginHooks, SyncPluginHooks>;
export type FirstPluginHooks =
| 'load'
| 'renderDynamicImport'
| 'resolveAssetUrl'
| 'resolveDynamicImport'
| 'resolveFileUrl'
| 'resolveId'
| 'resolveImportMeta'
| 'shouldTransformCachedModule';
export type SequentialPluginHooks =
| 'augmentChunkHash'
| 'generateBundle'
| 'options'
| 'outputOptions'
| 'renderChunk'
| 'transform';
export type ParallelPluginHooks = Exclude<
keyof FunctionPluginHooks | AddonHooks,
FirstPluginHooks | SequentialPluginHooks
>;
export type AddonHooks = 'banner' | 'footer' | 'intro' | 'outro';
type MakeAsync<Fn> = Fn extends (this: infer This, ...args: infer Args) => infer Return
? (this: This, ...args: Args) => Return | Promise<Return>
: never;
// eslint-disable-next-line @typescript-eslint/ban-types
type ObjectHook<T, O = {}> = T | ({ handler: T; order?: 'pre' | 'post' | null } & O);
export type PluginHooks = {
[K in keyof FunctionPluginHooks]: ObjectHook<
K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K],
// eslint-disable-next-line @typescript-eslint/ban-types
K extends ParallelPluginHooks ? { sequential?: boolean } : {}
>;
};
export interface OutputPlugin
extends Partial<{ [K in OutputPluginHooks]: PluginHooks[K] }>,
Partial<{ [K in AddonHooks]: ObjectHook<AddonHook> }> {
cacheKey?: string;
name: string;
}
export interface Plugin extends OutputPlugin, Partial<PluginHooks> {
// for inter-plugin communication
api?: any;
}
type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';
export interface NormalizedTreeshakingOptions {
annotations: boolean;
correctVarValueBeforeDeclaration: boolean;
moduleSideEffects: HasModuleSideEffects;
propertyReadSideEffects: boolean | 'always';
tryCatchDeoptimization: boolean;
unknownGlobalSideEffects: boolean;
}
export interface TreeshakingOptions
extends Partial<Omit<NormalizedTreeshakingOptions, 'moduleSideEffects'>> {
moduleSideEffects?: ModuleSideEffectsOption;
preset?: TreeshakingPreset;
/** @deprecated Use `moduleSideEffects` instead */
pureExternalModules?: PureModulesOption;
}
interface GetManualChunkApi {
getModuleIds: () => IterableIterator<string>;
getModuleInfo: GetModuleInfo;
}
export type GetManualChunk = (id: string, api: GetManualChunkApi) => string | null | void;
export type ExternalOption =
| (string | RegExp)[]
| string
| RegExp
| ((source: string, importer: string | undefined, isResolved: boolean) => boolean | null | void);
export type PureModulesOption = boolean | string[] | IsPureModule;
export type GlobalsOption = { [name: string]: string } | ((name: string) => string);
export type InputOption = string | string[] | { [entryAlias: string]: string };
export type ManualChunksOption = { [chunkAlias: string]: string[] } | GetManualChunk;
export type ModuleSideEffectsOption = boolean | 'no-external' | string[] | HasModuleSideEffects;
export type PreserveEntrySignaturesOption = false | 'strict' | 'allow-extension' | 'exports-only';
export type SourcemapPathTransformOption = (
relativeSourcePath: string,
sourcemapPath: string
) => string;
export interface InputOptions {
acorn?: Record<string, unknown>;
acornInjectPlugins?: (() => unknown)[] | (() => unknown);
cache?: false | RollupCache;
context?: string;
experimentalCacheExpiry?: number;
external?: ExternalOption;
/** @deprecated Use the "inlineDynamicImports" output option instead. */
inlineDynamicImports?: boolean;
input?: InputOption;
makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource';
/** @deprecated Use the "manualChunks" output option instead. */
manualChunks?: ManualChunksOption;
maxParallelFileOps?: number;
/** @deprecated Use the "maxParallelFileOps" option instead. */
maxParallelFileReads?: number;
moduleContext?: ((id: string) => string | null | void) | { [id: string]: string };
onwarn?: WarningHandlerWithDefault;
perf?: boolean;
plugins?: (Plugin | null | false | undefined)[];
preserveEntrySignatures?: PreserveEntrySignaturesOption;
/** @deprecated Use the "preserveModules" output option instead. */
preserveModules?: boolean;
preserveSymlinks?: boolean;
shimMissingExports?: boolean;
strictDeprecations?: boolean;
treeshake?: boolean | TreeshakingPreset | TreeshakingOptions;
watch?: WatcherOptions | false;
}
export interface NormalizedInputOptions {
acorn: Record<string, unknown>;
acornInjectPlugins: (() => unknown)[];
cache: false | undefined | RollupCache;
context: string;
experimentalCacheExpiry: number;
external: IsExternal;
/** @deprecated Use the "inlineDynamicImports" output option instead. */
inlineDynamicImports: boolean | undefined;
input: string[] | { [entryAlias: string]: string };
makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource';
/** @deprecated Use the "manualChunks" output option instead. */
manualChunks: ManualChunksOption | undefined;
maxParallelFileOps: number;
/** @deprecated Use the "maxParallelFileOps" option instead. */
maxParallelFileReads: number;
moduleContext: (id: string) => string;
onwarn: WarningHandler;
perf: boolean;
plugins: Plugin[];
preserveEntrySignatures: PreserveEntrySignaturesOption;
/** @deprecated Use the "preserveModules" output option instead. */
preserveModules: boolean | undefined;
preserveSymlinks: boolean;
shimMissingExports: boolean;
strictDeprecations: boolean;
treeshake: false | NormalizedTreeshakingOptions;
}
export type InternalModuleFormat = 'amd' | 'cjs' | 'es' | 'iife' | 'system' | 'umd';
export type ModuleFormat = InternalModuleFormat | 'commonjs' | 'esm' | 'module' | 'systemjs';
type GeneratedCodePreset = 'es5' | 'es2015';
interface NormalizedGeneratedCodeOptions {
arrowFunctions: boolean;
constBindings: boolean;
objectShorthand: boolean;
reservedNamesAsProps: boolean;
symbols: boolean;
}
interface GeneratedCodeOptions extends Partial<NormalizedGeneratedCodeOptions> {
preset?: GeneratedCodePreset;
}
export type OptionsPaths = Record<string, string> | ((id: string) => string);
export type InteropType = boolean | 'auto' | 'esModule' | 'default' | 'defaultOnly';
export type GetInterop = (id: string | null) => InteropType;
export type AmdOptions = (
| {
autoId?: false;
id: string;
}
| {
autoId: true;
basePath?: string;
id?: undefined;
}
| {
autoId?: false;
id?: undefined;
}
) & {
define?: string;
forceJsExtensionForImports?: boolean;
};
export type NormalizedAmdOptions = (
| {
autoId: false;
id?: string;
}
| {
autoId: true;
basePath: string;
}
) & {
define: string;
forceJsExtensionForImports: boolean;
};
export interface OutputOptions {
amd?: AmdOptions;
assetFileNames?: string | ((chunkInfo: PreRenderedAsset) => string);
banner?: string | (() => string | Promise<string>);
chunkFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
compact?: boolean;
// only required for bundle.write
dir?: string;
/** @deprecated Use the "renderDynamicImport" plugin hook instead. */
dynamicImportFunction?: string;
entryFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
esModule?: boolean;
exports?: 'default' | 'named' | 'none' | 'auto';
extend?: boolean;
externalLiveBindings?: boolean;
// only required for bundle.write
file?: string;
footer?: string | (() => string | Promise<string>);
format?: ModuleFormat;
freeze?: boolean;
generatedCode?: GeneratedCodePreset | GeneratedCodeOptions;
globals?: GlobalsOption;
hoistTransitiveImports?: boolean;
indent?: string | boolean;
inlineDynamicImports?: boolean;
interop?: InteropType | GetInterop;
intro?: string | (() => string | Promise<string>);
manualChunks?: ManualChunksOption;
minifyInternalExports?: boolean;
name?: string;
/** @deprecated Use "generatedCode.symbols" instead. */
namespaceToStringTag?: boolean;
noConflict?: boolean;
outro?: string | (() => string | Promise<string>);
paths?: OptionsPaths;
plugins?: (OutputPlugin | null | false | undefined)[];
/** @deprecated Use "generatedCode.constBindings" instead. */
preferConst?: boolean;
preserveModules?: boolean;
preserveModulesRoot?: string;
sanitizeFileName?: boolean | ((fileName: string) => string);
sourcemap?: boolean | 'inline' | 'hidden';
sourcemapBaseUrl?: string;
sourcemapExcludeSources?: boolean;
sourcemapFile?: string;
sourcemapPathTransform?: SourcemapPathTransformOption;
strict?: boolean;
systemNullSetters?: boolean;
validate?: boolean;
}
export interface NormalizedOutputOptions {
amd: NormalizedAmdOptions;
assetFileNames: string | ((chunkInfo: PreRenderedAsset) => string);
banner: () => string | Promise<string>;
chunkFileNames: string | ((chunkInfo: PreRenderedChunk) => string);
compact: boolean;
dir: string | undefined;
/** @deprecated Use the "renderDynamicImport" plugin hook instead. */
dynamicImportFunction: string | undefined;
entryFileNames: string | ((chunkInfo: PreRenderedChunk) => string);
esModule: boolean;
exports: 'default' | 'named' | 'none' | 'auto';
extend: boolean;
externalLiveBindings: boolean;
file: string | undefined;
footer: () => string | Promise<string>;
format: InternalModuleFormat;
freeze: boolean;
generatedCode: NormalizedGeneratedCodeOptions;
globals: GlobalsOption;
hoistTransitiveImports: boolean;
indent: true | string;
inlineDynamicImports: boolean;
interop: GetInterop;
intro: () => string | Promise<string>;
manualChunks: ManualChunksOption;
minifyInternalExports: boolean;
name: string | undefined;
namespaceToStringTag: boolean;
noConflict: boolean;
outro: () => string | Promise<string>;
paths: OptionsPaths;
plugins: OutputPlugin[];
/** @deprecated Use the "renderDynamicImport" plugin hook instead. */
preferConst: boolean;
preserveModules: boolean;
preserveModulesRoot: string | undefined;
sanitizeFileName: (fileName: string) => string;
sourcemap: boolean | 'inline' | 'hidden';
sourcemapBaseUrl: string | undefined;
sourcemapExcludeSources: boolean;
sourcemapFile: string | undefined;
sourcemapPathTransform: SourcemapPathTransformOption | undefined;
strict: boolean;
systemNullSetters: boolean;
validate: boolean;
}
export type WarningHandlerWithDefault = (
warning: RollupWarning,
defaultHandler: WarningHandler
) => void;
export type WarningHandler = (warning: RollupWarning) => void;
export interface SerializedTimings {
[label: string]: [number, number, number];
}
export interface PreRenderedAsset {
name: string | undefined;
source: string | Uint8Array;
type: 'asset';
}
export interface OutputAsset extends PreRenderedAsset {
fileName: string;
/** @deprecated Accessing "isAsset" on files in the bundle is deprecated, please use "type === \'asset\'" instead */
isAsset: true;
}
export interface RenderedModule {
code: string | null;
originalLength: number;
removedExports: string[];
renderedExports: string[];
renderedLength: number;
}
export interface PreRenderedChunk {
exports: string[];
facadeModuleId: string | null;
isDynamicEntry: boolean;
isEntry: boolean;
isImplicitEntry: boolean;
modules: {
[id: string]: RenderedModule;
};
name: string;
type: 'chunk';
}
export interface RenderedChunk extends PreRenderedChunk {
code?: string;
dynamicImports: string[];
fileName: string;
implicitlyLoadedBefore: string[];
importedBindings: {
[imported: string]: string[];
};
imports: string[];
map?: SourceMap;
referencedFiles: string[];
}
export interface OutputChunk extends RenderedChunk {
code: string;
}
export interface SerializablePluginCache {
[key: string]: [number, any];
}
export interface RollupCache {
modules: ModuleJSON[];
plugins?: Record<string, SerializablePluginCache>;
}
export interface RollupOutput {
output: [OutputChunk, ...(OutputChunk | OutputAsset)[]];
}
export interface RollupBuild {
cache: RollupCache | undefined;
close: () => Promise<void>;
closed: boolean;
generate: (outputOptions: OutputOptions) => Promise<RollupOutput>;
getTimings?: () => SerializedTimings;
watchFiles: string[];
write: (options: OutputOptions) => Promise<RollupOutput>;
}
export interface RollupOptions extends InputOptions {
// This is included for compatibility with config files but ignored by rollup.rollup
output?: OutputOptions | OutputOptions[];
}
export interface MergedRollupOptions extends InputOptions {
output: OutputOptions[];
}
export function rollup(options: RollupOptions): Promise<RollupBuild>;
export interface ChokidarOptions {
alwaysStat?: boolean;
atomic?: boolean | number;
awaitWriteFinish?:
| {
pollInterval?: number;
stabilityThreshold?: number;
}
| boolean;
binaryInterval?: number;
cwd?: string;
depth?: number;
disableGlobbing?: boolean;
followSymlinks?: boolean;
ignoreInitial?: boolean;
ignorePermissionErrors?: boolean;
ignored?: any;
interval?: number;
persistent?: boolean;
useFsEvents?: boolean;
usePolling?: boolean;
}
export type RollupWatchHooks = 'onError' | 'onStart' | 'onBundleStart' | 'onBundleEnd' | 'onEnd';
export interface WatcherOptions {
buildDelay?: number;
chokidar?: ChokidarOptions;
clearScreen?: boolean;
exclude?: string | RegExp | (string | RegExp)[];
include?: string | RegExp | (string | RegExp)[];
skipWrite?: boolean;
}
export interface RollupWatchOptions extends InputOptions {
output?: OutputOptions | OutputOptions[];
watch?: WatcherOptions | false;
}
interface TypedEventEmitter<T extends { [event: string]: (...args: any) => any }> {
addListener<K extends keyof T>(event: K, listener: T[K]): this;
emit<K extends keyof T>(event: K, ...args: Parameters<T[K]>): boolean;
eventNames(): Array<keyof T>;
getMaxListeners(): number;
listenerCount(type: keyof T): number;
listeners<K extends keyof T>(event: K): Array<T[K]>;
off<K extends keyof T>(event: K, listener: T[K]): this;
on<K extends keyof T>(event: K, listener: T[K]): this;
once<K extends keyof T>(event: K, listener: T[K]): this;
prependListener<K extends keyof T>(event: K, listener: T[K]): this;
prependOnceListener<K extends keyof T>(event: K, listener: T[K]): this;
rawListeners<K extends keyof T>(event: K): Array<T[K]>;
removeAllListeners<K extends keyof T>(event?: K): this;
removeListener<K extends keyof T>(event: K, listener: T[K]): this;
setMaxListeners(n: number): this;
}
export interface RollupAwaitingEmitter<T extends { [event: string]: (...args: any) => any }>
extends TypedEventEmitter<T> {
close(): Promise<void>;
emitAndAwait<K extends keyof T>(event: K, ...args: Parameters<T[K]>): Promise<ReturnType<T[K]>[]>;
/**
* Registers an event listener that will be awaited before Rollup continues
* for events emitted via emitAndAwait. All listeners will be awaited in
* parallel while rejections are tracked via Promise.all.
* Listeners are removed automatically when removeAwaited is called, which
* happens automatically after each run.
*/
onCurrentAwaited<K extends keyof T>(
event: K,
listener: (...args: Parameters<T[K]>) => Promise<ReturnType<T[K]>>
): this;
removeAwaited(): this;
}
export type RollupWatcherEvent =
| { code: 'START' }
| { code: 'BUNDLE_START'; input?: InputOption; output: readonly string[] }
| {
code: 'BUNDLE_END';
duration: number;
input?: InputOption;
output: readonly string[];
result: RollupBuild;
}
| { code: 'END' }
| { code: 'ERROR'; error: RollupError; result: RollupBuild | null };
export type RollupWatcher = RollupAwaitingEmitter<{
change: (id: string, change: { event: ChangeEvent }) => void;
close: () => void;
event: (event: RollupWatcherEvent) => void;
restart: () => void;
}>;
export function watch(config: RollupWatchOptions | RollupWatchOptions[]): RollupWatcher;
interface AcornNode {
end: number;
start: number;
type: string;
}
export function defineConfig(options: RollupOptions): RollupOptions;
export function defineConfig(options: RollupOptions[]): RollupOptions[];

View file

@ -0,0 +1,28 @@
/*
@license
Rollup.js v2.80.0
Sun, 22 Feb 2026 06:16:40 GMT - commit d17ae15336a45c3c59b2a4aacac2b14186035d28
https://github.com/rollup/rollup
Released under the MIT License.
*/
'use strict';
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
const rollup = require('./shared/rollup.js');
require('path');
require('process');
require('perf_hooks');
require('crypto');
require('fs');
require('events');
exports.VERSION = rollup.version;
exports.defineConfig = rollup.defineConfig;
exports.rollup = rollup.rollup;
exports.watch = rollup.watch;
//# sourceMappingURL=rollup.js.map

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,670 @@
/*
@license
Rollup.js v2.80.0
Sun, 22 Feb 2026 06:16:40 GMT - commit d17ae15336a45c3c59b2a4aacac2b14186035d28
https://github.com/rollup/rollup
Released under the MIT License.
*/
'use strict';
const require$$0 = require('path');
const process$1 = require('process');
const url = require('url');
const tty = require('tty');
const rollup = require('./rollup.js');
const mergeOptions = require('./mergeOptions.js');
function _interopNamespaceDefault(e) {
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
if (e) {
for (const k in e) {
n[k] = e[k];
}
}
n.default = e;
return n;
}
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
const {
env = {},
argv = [],
platform = "",
} = typeof process === "undefined" ? {} : process;
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
const isForced = "FORCE_COLOR" in env || argv.includes("--color");
const isWindows = platform === "win32";
const isDumbTerminal = env.TERM === "dumb";
const isCompatibleTerminal =
tty__namespace && tty__namespace.isatty && tty__namespace.isatty(1) && env.TERM && !isDumbTerminal;
const isCI =
"CI" in env &&
("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
const isColorSupported =
!isDisabled &&
(isForced || (isWindows && !isDumbTerminal) || isCompatibleTerminal || isCI);
const replaceClose = (
index,
string,
close,
replace,
head = string.substring(0, index) + replace,
tail = string.substring(index + close.length),
next = tail.indexOf(close)
) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
const clearBleed = (index, string, open, close, replace) =>
index < 0
? open + string + close
: open + replaceClose(index, string, close, replace) + close;
const filterEmpty =
(open, close, replace = open, at = open.length + 1) =>
(string) =>
string || !(string === "" || string === undefined)
? clearBleed(
("" + string).indexOf(close, at),
string,
open,
close,
replace
)
: "";
const init = (open, close, replace) =>
filterEmpty(`\x1b[${open}m`, `\x1b[${close}m`, replace);
const colors = {
reset: init(0, 0),
bold: init(1, 22, "\x1b[22m\x1b[1m"),
dim: init(2, 22, "\x1b[22m\x1b[2m"),
italic: init(3, 23),
underline: init(4, 24),
inverse: init(7, 27),
hidden: init(8, 28),
strikethrough: init(9, 29),
black: init(30, 39),
red: init(31, 39),
green: init(32, 39),
yellow: init(33, 39),
blue: init(34, 39),
magenta: init(35, 39),
cyan: init(36, 39),
white: init(37, 39),
gray: init(90, 39),
bgBlack: init(40, 49),
bgRed: init(41, 49),
bgGreen: init(42, 49),
bgYellow: init(43, 49),
bgBlue: init(44, 49),
bgMagenta: init(45, 49),
bgCyan: init(46, 49),
bgWhite: init(47, 49),
blackBright: init(90, 39),
redBright: init(91, 39),
greenBright: init(92, 39),
yellowBright: init(93, 39),
blueBright: init(94, 39),
magentaBright: init(95, 39),
cyanBright: init(96, 39),
whiteBright: init(97, 39),
bgBlackBright: init(100, 49),
bgRedBright: init(101, 49),
bgGreenBright: init(102, 49),
bgYellowBright: init(103, 49),
bgBlueBright: init(104, 49),
bgMagentaBright: init(105, 49),
bgCyanBright: init(106, 49),
bgWhiteBright: init(107, 49),
};
const createColors = ({ useColor = isColorSupported } = {}) =>
useColor
? colors
: Object.keys(colors).reduce(
(colors, key) => ({ ...colors, [key]: String }),
{}
);
createColors();
// @see https://no-color.org
// @see https://www.npmjs.com/package/chalk
const { bold, cyan, dim, gray, green, red, underline, yellow } = createColors({
useColor: process$1.env.FORCE_COLOR !== '0' && !process$1.env.NO_COLOR
});
// log to stderr to keep `rollup main.js > bundle.js` from breaking
const stderr = (...args) => process$1.stderr.write(`${args.join('')}\n`);
function handleError(err, recover = false) {
let description = err.message || err;
if (err.name)
description = `${err.name}: ${description}`;
const message = (err.plugin ? `(plugin ${err.plugin}) ${description}` : description) || err;
stderr(bold(red(`[!] ${bold(message.toString())}`)));
if (err.url) {
stderr(cyan(err.url));
}
if (err.loc) {
stderr(`${rollup.relativeId((err.loc.file || err.id))} (${err.loc.line}:${err.loc.column})`);
}
else if (err.id) {
stderr(rollup.relativeId(err.id));
}
if (err.frame) {
stderr(dim(err.frame));
}
if (err.stack) {
stderr(dim(err.stack));
}
stderr('');
if (!recover)
process$1.exit(1);
}
function batchWarnings() {
let count = 0;
const deferredWarnings = new Map();
let warningOccurred = false;
return {
add(warning) {
count += 1;
warningOccurred = true;
if (warning.code in deferredHandlers) {
rollup.getOrCreate(deferredWarnings, warning.code, () => []).push(warning);
}
else if (warning.code in immediateHandlers) {
immediateHandlers[warning.code](warning);
}
else {
title(warning.message);
if (warning.url)
info(warning.url);
const id = (warning.loc && warning.loc.file) || warning.id;
if (id) {
const loc = warning.loc
? `${rollup.relativeId(id)} (${warning.loc.line}:${warning.loc.column})`
: rollup.relativeId(id);
stderr(bold(rollup.relativeId(loc)));
}
if (warning.frame)
info(warning.frame);
}
},
get count() {
return count;
},
flush() {
if (count === 0)
return;
const codes = Array.from(deferredWarnings.keys()).sort((a, b) => deferredWarnings.get(b).length - deferredWarnings.get(a).length);
for (const code of codes) {
deferredHandlers[code](deferredWarnings.get(code));
}
deferredWarnings.clear();
count = 0;
},
get warningOccurred() {
return warningOccurred;
}
};
}
const immediateHandlers = {
MISSING_NODE_BUILTINS(warning) {
title(`Missing shims for Node.js built-ins`);
stderr(`Creating a browser bundle that depends on ${rollup.printQuotedStringList(warning.modules)}. You might need to include https://github.com/FredKSchott/rollup-plugin-polyfill-node`);
},
UNKNOWN_OPTION(warning) {
title(`You have passed an unrecognized option`);
stderr(warning.message);
}
};
const deferredHandlers = {
CIRCULAR_DEPENDENCY(warnings) {
title(`Circular dependenc${warnings.length > 1 ? 'ies' : 'y'}`);
const displayed = warnings.length > 5 ? warnings.slice(0, 3) : warnings;
for (const warning of displayed) {
stderr(warning.cycle.join(' -> '));
}
if (warnings.length > displayed.length) {
stderr(`...and ${warnings.length - displayed.length} more`);
}
},
EMPTY_BUNDLE(warnings) {
title(`Generated${warnings.length === 1 ? ' an' : ''} empty ${warnings.length > 1 ? 'chunks' : 'chunk'}`);
stderr(warnings.map(warning => warning.chunkName).join(', '));
},
EVAL(warnings) {
title('Use of eval is strongly discouraged');
info('https://rollupjs.org/guide/en/#avoiding-eval');
showTruncatedWarnings(warnings);
},
MISSING_EXPORT(warnings) {
title('Missing exports');
info('https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module');
for (const warning of warnings) {
stderr(bold(warning.importer));
stderr(`${warning.missing} is not exported by ${warning.exporter}`);
stderr(gray(warning.frame));
}
},
MISSING_GLOBAL_NAME(warnings) {
title(`Missing global variable ${warnings.length > 1 ? 'names' : 'name'}`);
stderr(`Use output.globals to specify browser global variable names corresponding to external modules`);
for (const warning of warnings) {
stderr(`${bold(warning.source)} (guessing '${warning.guess}')`);
}
},
MIXED_EXPORTS(warnings) {
title('Mixing named and default exports');
info(`https://rollupjs.org/guide/en/#outputexports`);
stderr(bold('The following entry modules are using named and default exports together:'));
warnings.sort((a, b) => (a.id < b.id ? -1 : 1));
const displayedWarnings = warnings.length > 5 ? warnings.slice(0, 3) : warnings;
for (const warning of displayedWarnings) {
stderr(rollup.relativeId(warning.id));
}
if (displayedWarnings.length < warnings.length) {
stderr(`...and ${warnings.length - displayedWarnings.length} other entry modules`);
}
stderr(`\nConsumers of your bundle will have to use chunk['default'] to access their default export, which may not be what you want. Use \`output.exports: 'named'\` to disable this warning`);
},
NAMESPACE_CONFLICT(warnings) {
title(`Conflicting re-exports`);
for (const warning of warnings) {
stderr(`"${bold(rollup.relativeId(warning.reexporter))}" re-exports "${warning.name}" from both "${rollup.relativeId(warning.sources[0])}" and "${rollup.relativeId(warning.sources[1])}" (will be ignored)`);
}
},
NON_EXISTENT_EXPORT(warnings) {
title(`Import of non-existent ${warnings.length > 1 ? 'exports' : 'export'}`);
showTruncatedWarnings(warnings);
},
PLUGIN_WARNING(warnings) {
var _a;
const nestedByPlugin = nest(warnings, 'plugin');
for (const { key: plugin, items } of nestedByPlugin) {
const nestedByMessage = nest(items, 'message');
let lastUrl = '';
for (const { key: message, items } of nestedByMessage) {
title(`Plugin ${plugin}: ${message}`);
for (const warning of items) {
if (warning.url && warning.url !== lastUrl)
info((lastUrl = warning.url));
const id = warning.id || ((_a = warning.loc) === null || _a === void 0 ? void 0 : _a.file);
if (id) {
let loc = rollup.relativeId(id);
if (warning.loc) {
loc += `: (${warning.loc.line}:${warning.loc.column})`;
}
stderr(bold(loc));
}
if (warning.frame)
info(warning.frame);
}
}
}
},
SOURCEMAP_BROKEN(warnings) {
title(`Broken sourcemap`);
info('https://rollupjs.org/guide/en/#warning-sourcemap-is-likely-to-be-incorrect');
const plugins = [...new Set(warnings.map(({ plugin }) => plugin).filter(Boolean))];
stderr(`Plugins that transform code (such as ${rollup.printQuotedStringList(plugins)}) should generate accompanying sourcemaps`);
},
THIS_IS_UNDEFINED(warnings) {
title('`this` has been rewritten to `undefined`');
info('https://rollupjs.org/guide/en/#error-this-is-undefined');
showTruncatedWarnings(warnings);
},
UNRESOLVED_IMPORT(warnings) {
title('Unresolved dependencies');
info('https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency');
const dependencies = new Map();
for (const warning of warnings) {
rollup.getOrCreate(dependencies, warning.source, () => []).push(warning.importer);
}
for (const [dependency, importers] of dependencies) {
stderr(`${bold(dependency)} (imported by ${importers.join(', ')})`);
}
},
UNUSED_EXTERNAL_IMPORT(warnings) {
title('Unused external imports');
for (const warning of warnings) {
stderr(warning.names +
' imported from external module "' +
warning.source +
'" but never used in ' +
rollup.printQuotedStringList(warning.sources.map(id => rollup.relativeId(id))));
}
}
};
function title(str) {
stderr(bold(yellow(`(!) ${str}`)));
}
function info(url) {
stderr(gray(url));
}
function nest(array, prop) {
const nested = [];
const lookup = new Map();
for (const item of array) {
const key = item[prop];
rollup.getOrCreate(lookup, key, () => {
const items = {
items: [],
key
};
nested.push(items);
return items;
}).items.push(item);
}
return nested;
}
function showTruncatedWarnings(warnings) {
const nestedByModule = nest(warnings, 'id');
const displayedByModule = nestedByModule.length > 5 ? nestedByModule.slice(0, 3) : nestedByModule;
for (const { key: id, items } of displayedByModule) {
stderr(bold(rollup.relativeId(id)));
stderr(gray(items[0].frame));
if (items.length > 1) {
stderr(`...and ${items.length - 1} other ${items.length > 2 ? 'occurrences' : 'occurrence'}`);
}
}
if (nestedByModule.length > displayedByModule.length) {
stderr(`\n...and ${nestedByModule.length - displayedByModule.length} other files`);
}
}
const stdinName = '-';
let stdinResult = null;
function stdinPlugin(arg) {
const suffix = typeof arg == 'string' && arg.length ? '.' + arg : '';
return {
load(id) {
if (id === stdinName || id.startsWith(stdinName + '.')) {
return stdinResult || (stdinResult = readStdin());
}
},
name: 'stdin',
resolveId(id) {
if (id === stdinName) {
return id + suffix;
}
}
};
}
function readStdin() {
return new Promise((resolve, reject) => {
const chunks = [];
process$1.stdin.setEncoding('utf8');
process$1.stdin
.on('data', chunk => chunks.push(chunk))
.on('end', () => {
const result = chunks.join('');
resolve(result);
})
.on('error', err => {
reject(err);
});
});
}
function waitForInputPlugin() {
return {
async buildStart(options) {
const inputSpecifiers = Array.isArray(options.input)
? options.input
: Object.keys(options.input);
let lastAwaitedSpecifier = null;
checkSpecifiers: while (true) {
for (const specifier of inputSpecifiers) {
if ((await this.resolve(specifier)) === null) {
if (lastAwaitedSpecifier !== specifier) {
stderr(`waiting for input ${bold(specifier)}...`);
lastAwaitedSpecifier = specifier;
}
await new Promise(resolve => setTimeout(resolve, 500));
continue checkSpecifiers;
}
}
break;
}
},
name: 'wait-for-input'
};
}
async function addCommandPluginsToInputOptions(inputOptions, command) {
if (command.stdin !== false) {
inputOptions.plugins.push(stdinPlugin(command.stdin));
}
if (command.waitForBundleInput === true) {
inputOptions.plugins.push(waitForInputPlugin());
}
await addPluginsFromCommandOption(command.plugin, inputOptions);
}
async function addPluginsFromCommandOption(commandPlugin, inputOptions) {
if (commandPlugin) {
const plugins = Array.isArray(commandPlugin) ? commandPlugin : [commandPlugin];
for (const plugin of plugins) {
if (/[={}]/.test(plugin)) {
// -p plugin=value
// -p "{transform(c,i){...}}"
await loadAndRegisterPlugin(inputOptions, plugin);
}
else {
// split out plugins joined by commas
// -p node-resolve,commonjs,buble
for (const p of plugin.split(',')) {
await loadAndRegisterPlugin(inputOptions, p);
}
}
}
}
}
async function loadAndRegisterPlugin(inputOptions, pluginText) {
let plugin = null;
let pluginArg = undefined;
if (pluginText[0] === '{') {
// -p "{transform(c,i){...}}"
plugin = new Function('return ' + pluginText);
}
else {
const match = pluginText.match(/^([@.:/\\\w|^{}-]+)(=(.*))?$/);
if (match) {
// -p plugin
// -p plugin=arg
pluginText = match[1];
pluginArg = new Function('return ' + match[3])();
}
else {
throw new Error(`Invalid --plugin argument format: ${JSON.stringify(pluginText)}`);
}
if (!/^\.|^rollup-plugin-|[@/\\]/.test(pluginText)) {
// Try using plugin prefix variations first if applicable.
// Prefix order is significant - left has higher precedence.
for (const prefix of ['@rollup/plugin-', 'rollup-plugin-']) {
try {
plugin = await requireOrImport(prefix + pluginText);
break;
}
catch (_a) {
// if this does not work, we try requiring the actual name below
}
}
}
if (!plugin) {
try {
if (pluginText[0] == '.')
pluginText = require$$0.resolve(pluginText);
// Windows absolute paths must be specified as file:// protocol URL
// Note that we do not have coverage for Windows-only code paths
else if (pluginText.match(/^[A-Za-z]:\\/)) {
pluginText = url.pathToFileURL(require$$0.resolve(pluginText)).href;
}
plugin = await requireOrImport(pluginText);
}
catch (err) {
throw new Error(`Cannot load plugin "${pluginText}": ${err.message}.`);
}
}
}
// some plugins do not use `module.exports` for their entry point,
// in which case we try the named default export and the plugin name
if (typeof plugin === 'object') {
plugin = plugin.default || plugin[getCamelizedPluginBaseName(pluginText)];
}
if (!plugin) {
throw new Error(`Cannot find entry for plugin "${pluginText}". The plugin needs to export a function either as "default" or "${getCamelizedPluginBaseName(pluginText)}" for Rollup to recognize it.`);
}
inputOptions.plugins.push(typeof plugin === 'function' ? plugin.call(plugin, pluginArg) : plugin);
}
function getCamelizedPluginBaseName(pluginText) {
var _a;
return (((_a = pluginText.match(/(@rollup\/plugin-|rollup-plugin-)(.+)$/)) === null || _a === void 0 ? void 0 : _a[2]) || pluginText)
.split(/[\\/]/)
.slice(-1)[0]
.split('.')[0]
.split('-')
.map((part, index) => (index === 0 || !part ? part : part[0].toUpperCase() + part.slice(1)))
.join('');
}
async function requireOrImport(pluginPath) {
try {
return require(pluginPath);
}
catch (_a) {
return import(pluginPath);
}
}
function supportsNativeESM() {
return Number(/^v(\d+)/.exec(process$1.version)[1]) >= 13;
}
async function loadAndParseConfigFile(fileName, commandOptions = {}) {
const configs = await loadConfigFile(fileName, commandOptions);
const warnings = batchWarnings();
try {
const normalizedConfigs = [];
for (const config of configs) {
const options = mergeOptions.mergeOptions(config, commandOptions, warnings.add);
await addCommandPluginsToInputOptions(options, commandOptions);
normalizedConfigs.push(options);
}
return { options: normalizedConfigs, warnings };
}
catch (err) {
warnings.flush();
throw err;
}
}
async function loadConfigFile(fileName, commandOptions) {
const extension = require$$0.extname(fileName);
const configFileExport = commandOptions.configPlugin ||
!(extension === '.cjs' || (extension === '.mjs' && supportsNativeESM()))
? await getDefaultFromTranspiledConfigFile(fileName, commandOptions)
: extension === '.cjs'
? getDefaultFromCjs(require(fileName))
: (await import(url.pathToFileURL(fileName).href)).default;
return getConfigList(configFileExport, commandOptions);
}
function getDefaultFromCjs(namespace) {
return namespace.__esModule ? namespace.default : namespace;
}
async function getDefaultFromTranspiledConfigFile(fileName, commandOptions) {
const warnings = batchWarnings();
const inputOptions = {
external: (id) => (id[0] !== '.' && !require$$0.isAbsolute(id)) || id.slice(-5, id.length) === '.json',
input: fileName,
onwarn: warnings.add,
plugins: [],
treeshake: false
};
await addPluginsFromCommandOption(commandOptions.configPlugin, inputOptions);
const bundle = await rollup.rollup(inputOptions);
if (!commandOptions.silent && warnings.count > 0) {
stderr(bold(`loaded ${rollup.relativeId(fileName)} with warnings`));
warnings.flush();
}
const { output: [{ code }] } = await bundle.generate({
exports: 'named',
format: 'cjs',
plugins: [
{
name: 'transpile-import-meta',
resolveImportMeta(property, { moduleId }) {
if (property === 'url') {
return `'${url.pathToFileURL(moduleId).href}'`;
}
if (property == null) {
return `{url:'${url.pathToFileURL(moduleId).href}'}`;
}
}
}
]
});
return loadConfigFromBundledFile(fileName, code);
}
function loadConfigFromBundledFile(fileName, bundledCode) {
const resolvedFileName = require.resolve(fileName);
const extension = require$$0.extname(resolvedFileName);
const defaultLoader = require.extensions[extension];
require.extensions[extension] = (module, requiredFileName) => {
if (requiredFileName === resolvedFileName) {
module._compile(bundledCode, requiredFileName);
}
else {
if (defaultLoader) {
defaultLoader(module, requiredFileName);
}
}
};
delete require.cache[resolvedFileName];
try {
const config = getDefaultFromCjs(require(fileName));
require.extensions[extension] = defaultLoader;
return config;
}
catch (err) {
if (err.code === 'ERR_REQUIRE_ESM') {
return rollup.error({
code: 'TRANSPILED_ESM_CONFIG',
message: `While loading the Rollup configuration from "${rollup.relativeId(fileName)}", Node tried to require an ES module from a CommonJS file, which is not supported. A common cause is if there is a package.json file with "type": "module" in the same folder. You can try to fix this by changing the extension of your configuration file to ".cjs" or ".mjs" depending on the content, which will prevent Rollup from trying to preprocess the file but rather hand it to Node directly.`,
url: 'https://rollupjs.org/guide/en/#using-untranspiled-config-files'
});
}
throw err;
}
}
async function getConfigList(configFileExport, commandOptions) {
const config = await (typeof configFileExport === 'function'
? configFileExport(commandOptions)
: configFileExport);
if (Object.keys(config).length === 0) {
return rollup.error({
code: 'MISSING_CONFIG',
message: 'Config file must export an options object, or an array of options objects',
url: 'https://rollupjs.org/guide/en/#configuration-files'
});
}
return Array.isArray(config) ? config : [config];
}
exports.addCommandPluginsToInputOptions = addCommandPluginsToInputOptions;
exports.batchWarnings = batchWarnings;
exports.bold = bold;
exports.cyan = cyan;
exports.green = green;
exports.handleError = handleError;
exports.loadAndParseConfigFile = loadAndParseConfigFile;
exports.stderr = stderr;
exports.stdinName = stdinName;
exports.underline = underline;
//# sourceMappingURL=loadConfigFile.js.map

View file

@ -0,0 +1,180 @@
/*
@license
Rollup.js v2.80.0
Sun, 22 Feb 2026 06:16:40 GMT - commit d17ae15336a45c3c59b2a4aacac2b14186035d28
https://github.com/rollup/rollup
Released under the MIT License.
*/
'use strict';
const rollup = require('./rollup.js');
const commandAliases = {
c: 'config',
d: 'dir',
e: 'external',
f: 'format',
g: 'globals',
h: 'help',
i: 'input',
m: 'sourcemap',
n: 'name',
o: 'file',
p: 'plugin',
v: 'version',
w: 'watch'
};
function mergeOptions(config, rawCommandOptions = { external: [], globals: undefined }, defaultOnWarnHandler = rollup.defaultOnWarn) {
const command = getCommandOptions(rawCommandOptions);
const inputOptions = mergeInputOptions(config, command, defaultOnWarnHandler);
const warn = inputOptions.onwarn;
if (command.output) {
Object.assign(command, command.output);
}
const outputOptionsArray = rollup.ensureArray(config.output);
if (outputOptionsArray.length === 0)
outputOptionsArray.push({});
const outputOptions = outputOptionsArray.map(singleOutputOptions => mergeOutputOptions(singleOutputOptions, command, warn));
rollup.warnUnknownOptions(command, Object.keys(inputOptions).concat(Object.keys(outputOptions[0]).filter(option => option !== 'sourcemapPathTransform'), Object.keys(commandAliases), 'config', 'environment', 'plugin', 'silent', 'failAfterWarnings', 'stdin', 'waitForBundleInput', 'configPlugin'), 'CLI flags', warn, /^_$|output$|config/);
inputOptions.output = outputOptions;
return inputOptions;
}
function getCommandOptions(rawCommandOptions) {
const external = rawCommandOptions.external && typeof rawCommandOptions.external === 'string'
? rawCommandOptions.external.split(',')
: [];
return {
...rawCommandOptions,
external,
globals: typeof rawCommandOptions.globals === 'string'
? rawCommandOptions.globals.split(',').reduce((globals, globalDefinition) => {
const [id, variableName] = globalDefinition.split(':');
globals[id] = variableName;
if (!external.includes(id)) {
external.push(id);
}
return globals;
}, Object.create(null))
: undefined
};
}
function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
const getOption = (name) => { var _a; return (_a = overrides[name]) !== null && _a !== void 0 ? _a : config[name]; };
const inputOptions = {
acorn: getOption('acorn'),
acornInjectPlugins: config.acornInjectPlugins,
cache: config.cache,
context: getOption('context'),
experimentalCacheExpiry: getOption('experimentalCacheExpiry'),
external: getExternal(config, overrides),
inlineDynamicImports: getOption('inlineDynamicImports'),
input: getOption('input') || [],
makeAbsoluteExternalsRelative: getOption('makeAbsoluteExternalsRelative'),
manualChunks: getOption('manualChunks'),
maxParallelFileOps: getOption('maxParallelFileOps'),
maxParallelFileReads: getOption('maxParallelFileReads'),
moduleContext: getOption('moduleContext'),
onwarn: getOnWarn(config, defaultOnWarnHandler),
perf: getOption('perf'),
plugins: rollup.ensureArray(config.plugins),
preserveEntrySignatures: getOption('preserveEntrySignatures'),
preserveModules: getOption('preserveModules'),
preserveSymlinks: getOption('preserveSymlinks'),
shimMissingExports: getOption('shimMissingExports'),
strictDeprecations: getOption('strictDeprecations'),
treeshake: getObjectOption(config, overrides, 'treeshake', rollup.objectifyOptionWithPresets(rollup.treeshakePresets, 'treeshake', 'false, true, ')),
watch: getWatch(config, overrides)
};
rollup.warnUnknownOptions(config, Object.keys(inputOptions), 'input options', inputOptions.onwarn, /^output$/);
return inputOptions;
}
const getExternal = (config, overrides) => {
const configExternal = config.external;
return typeof configExternal === 'function'
? (source, importer, isResolved) => configExternal(source, importer, isResolved) || overrides.external.includes(source)
: rollup.ensureArray(configExternal).concat(overrides.external);
};
const getOnWarn = (config, defaultOnWarnHandler) => config.onwarn
? warning => config.onwarn(warning, defaultOnWarnHandler)
: defaultOnWarnHandler;
const getObjectOption = (config, overrides, name, objectifyValue = rollup.objectifyOption) => {
const commandOption = normalizeObjectOptionValue(overrides[name], objectifyValue);
const configOption = normalizeObjectOptionValue(config[name], objectifyValue);
if (commandOption !== undefined) {
return commandOption && { ...configOption, ...commandOption };
}
return configOption;
};
const getWatch = (config, overrides) => config.watch !== false && getObjectOption(config, overrides, 'watch');
const isWatchEnabled = (optionValue) => {
if (Array.isArray(optionValue)) {
return optionValue.reduce((result, value) => (typeof value === 'boolean' ? value : result), false);
}
return optionValue === true;
};
const normalizeObjectOptionValue = (optionValue, objectifyValue) => {
if (!optionValue) {
return optionValue;
}
if (Array.isArray(optionValue)) {
return optionValue.reduce((result, value) => value && result && { ...result, ...objectifyValue(value) }, {});
}
return objectifyValue(optionValue);
};
function mergeOutputOptions(config, overrides, warn) {
const getOption = (name) => { var _a; return (_a = overrides[name]) !== null && _a !== void 0 ? _a : config[name]; };
const outputOptions = {
amd: getObjectOption(config, overrides, 'amd'),
assetFileNames: getOption('assetFileNames'),
banner: getOption('banner'),
chunkFileNames: getOption('chunkFileNames'),
compact: getOption('compact'),
dir: getOption('dir'),
dynamicImportFunction: getOption('dynamicImportFunction'),
entryFileNames: getOption('entryFileNames'),
esModule: getOption('esModule'),
exports: getOption('exports'),
extend: getOption('extend'),
externalLiveBindings: getOption('externalLiveBindings'),
file: getOption('file'),
footer: getOption('footer'),
format: getOption('format'),
freeze: getOption('freeze'),
generatedCode: getObjectOption(config, overrides, 'generatedCode', rollup.objectifyOptionWithPresets(rollup.generatedCodePresets, 'output.generatedCode', '')),
globals: getOption('globals'),
hoistTransitiveImports: getOption('hoistTransitiveImports'),
indent: getOption('indent'),
inlineDynamicImports: getOption('inlineDynamicImports'),
interop: getOption('interop'),
intro: getOption('intro'),
manualChunks: getOption('manualChunks'),
minifyInternalExports: getOption('minifyInternalExports'),
name: getOption('name'),
namespaceToStringTag: getOption('namespaceToStringTag'),
noConflict: getOption('noConflict'),
outro: getOption('outro'),
paths: getOption('paths'),
plugins: rollup.ensureArray(config.plugins),
preferConst: getOption('preferConst'),
preserveModules: getOption('preserveModules'),
preserveModulesRoot: getOption('preserveModulesRoot'),
sanitizeFileName: getOption('sanitizeFileName'),
sourcemap: getOption('sourcemap'),
sourcemapBaseUrl: getOption('sourcemapBaseUrl'),
sourcemapExcludeSources: getOption('sourcemapExcludeSources'),
sourcemapFile: getOption('sourcemapFile'),
sourcemapPathTransform: getOption('sourcemapPathTransform'),
strict: getOption('strict'),
systemNullSetters: getOption('systemNullSetters'),
validate: getOption('validate')
};
rollup.warnUnknownOptions(config, Object.keys(outputOptions), 'output options', warn);
return outputOptions;
}
exports.commandAliases = commandAliases;
exports.isWatchEnabled = isWatchEnabled;
exports.mergeOptions = mergeOptions;
//# sourceMappingURL=mergeOptions.js.map

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,511 @@
/*
@license
Rollup.js v2.80.0
Sun, 22 Feb 2026 06:16:40 GMT - commit d17ae15336a45c3c59b2a4aacac2b14186035d28
https://github.com/rollup/rollup
Released under the MIT License.
*/
'use strict';
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require$$0$2 = require('fs');
const process$2 = require('process');
const index = require('./index.js');
const cli = require('../bin/rollup');
const rollup = require('./rollup.js');
const require$$0 = require('assert');
const require$$0$1 = require('events');
const loadConfigFile_js = require('./loadConfigFile.js');
const child_process = require('child_process');
require('util');
require('stream');
require('path');
require('os');
require('./mergeOptions.js');
require('perf_hooks');
require('crypto');
require('url');
require('tty');
function timeZone(date = new Date()) {
const offset = date.getTimezoneOffset();
const absOffset = Math.abs(offset);
const hours = Math.floor(absOffset / 60);
const minutes = absOffset % 60;
const minutesOut = minutes > 0 ? ':' + ('0' + minutes).slice(-2) : '';
return (offset < 0 ? '+' : '-') + hours + minutesOut;
}
function dateTime(options = {}) {
let {
date = new Date(),
local = true,
showTimeZone = false,
showMilliseconds = false
} = options;
if (local) {
// Offset the date so it will return the correct value when getting the ISO string.
date = new Date(date.getTime() - (date.getTimezoneOffset() * 60000));
}
let end = '';
if (showTimeZone) {
end = ' UTC' + (local ? timeZone(date) : '');
}
if (showMilliseconds && date.getUTCMilliseconds() > 0) {
end = ` ${date.getUTCMilliseconds()}ms${end}`;
}
return date
.toISOString()
.replace(/T/, ' ')
.replace(/\..+/, end);
}
var signalExit = {exports: {}};
var signals$1 = {exports: {}};
var hasRequiredSignals;
function requireSignals () {
if (hasRequiredSignals) return signals$1.exports;
hasRequiredSignals = 1;
(function (module) {
// This is not the set of all possible signals.
//
// It IS, however, the set of all signals that trigger
// an exit on either Linux or BSD systems. Linux is a
// superset of the signal names supported on BSD, and
// the unknown signals just fail to register, so we can
// catch that easily enough.
//
// Don't bother with SIGKILL. It's uncatchable, which
// means that we can't fire any callbacks anyway.
//
// If a user does happen to register a handler on a non-
// fatal signal like SIGWINCH or something, and then
// exit, it'll end up firing `process.emit('exit')`, so
// the handler will be fired anyway.
//
// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
// artificially, inherently leave the process in a
// state from which it is not safe to try and enter JS
// listeners.
module.exports = [
'SIGABRT',
'SIGALRM',
'SIGHUP',
'SIGINT',
'SIGTERM'
];
if (process.platform !== 'win32') {
module.exports.push(
'SIGVTALRM',
'SIGXCPU',
'SIGXFSZ',
'SIGUSR2',
'SIGTRAP',
'SIGSYS',
'SIGQUIT',
'SIGIOT'
// should detect profiler and enable/disable accordingly.
// see #21
// 'SIGPROF'
);
}
if (process.platform === 'linux') {
module.exports.push(
'SIGIO',
'SIGPOLL',
'SIGPWR',
'SIGSTKFLT',
'SIGUNUSED'
);
}
} (signals$1));
return signals$1.exports;
}
// Note: since nyc uses this module to output coverage, any lines
// that are in the direct sync flow of nyc's outputCoverage are
// ignored, since we can never get coverage for them.
// grab a reference to node's real process object right away
var process$1 = rollup.commonjsGlobal.process;
const processOk = function (process) {
return process &&
typeof process === 'object' &&
typeof process.removeListener === 'function' &&
typeof process.emit === 'function' &&
typeof process.reallyExit === 'function' &&
typeof process.listeners === 'function' &&
typeof process.kill === 'function' &&
typeof process.pid === 'number' &&
typeof process.on === 'function'
};
// some kind of non-node environment, just no-op
/* istanbul ignore if */
if (!processOk(process$1)) {
signalExit.exports = function () {
return function () {}
};
} else {
var assert = require$$0;
var signals = requireSignals();
var isWin = /^win/i.test(process$1.platform);
var EE = require$$0$1;
/* istanbul ignore if */
if (typeof EE !== 'function') {
EE = EE.EventEmitter;
}
var emitter;
if (process$1.__signal_exit_emitter__) {
emitter = process$1.__signal_exit_emitter__;
} else {
emitter = process$1.__signal_exit_emitter__ = new EE();
emitter.count = 0;
emitter.emitted = {};
}
// Because this emitter is a global, we have to check to see if a
// previous version of this library failed to enable infinite listeners.
// I know what you're about to say. But literally everything about
// signal-exit is a compromise with evil. Get used to it.
if (!emitter.infinite) {
emitter.setMaxListeners(Infinity);
emitter.infinite = true;
}
signalExit.exports = function (cb, opts) {
/* istanbul ignore if */
if (!processOk(rollup.commonjsGlobal.process)) {
return function () {}
}
assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler');
if (loaded === false) {
load();
}
var ev = 'exit';
if (opts && opts.alwaysLast) {
ev = 'afterexit';
}
var remove = function () {
emitter.removeListener(ev, cb);
if (emitter.listeners('exit').length === 0 &&
emitter.listeners('afterexit').length === 0) {
unload();
}
};
emitter.on(ev, cb);
return remove
};
var unload = function unload () {
if (!loaded || !processOk(rollup.commonjsGlobal.process)) {
return
}
loaded = false;
signals.forEach(function (sig) {
try {
process$1.removeListener(sig, sigListeners[sig]);
} catch (er) {}
});
process$1.emit = originalProcessEmit;
process$1.reallyExit = originalProcessReallyExit;
emitter.count -= 1;
};
signalExit.exports.unload = unload;
var emit = function emit (event, code, signal) {
/* istanbul ignore if */
if (emitter.emitted[event]) {
return
}
emitter.emitted[event] = true;
emitter.emit(event, code, signal);
};
// { <signal>: <listener fn>, ... }
var sigListeners = {};
signals.forEach(function (sig) {
sigListeners[sig] = function listener () {
/* istanbul ignore if */
if (!processOk(rollup.commonjsGlobal.process)) {
return
}
// If there are no other listeners, an exit is coming!
// Simplest way: remove us and then re-send the signal.
// We know that this will kill the process, so we can
// safely emit now.
var listeners = process$1.listeners(sig);
if (listeners.length === emitter.count) {
unload();
emit('exit', null, sig);
/* istanbul ignore next */
emit('afterexit', null, sig);
/* istanbul ignore next */
if (isWin && sig === 'SIGHUP') {
// "SIGHUP" throws an `ENOSYS` error on Windows,
// so use a supported signal instead
sig = 'SIGINT';
}
/* istanbul ignore next */
process$1.kill(process$1.pid, sig);
}
};
});
signalExit.exports.signals = function () {
return signals
};
var loaded = false;
var load = function load () {
if (loaded || !processOk(rollup.commonjsGlobal.process)) {
return
}
loaded = true;
// This is the number of onSignalExit's that are in play.
// It's important so that we can count the correct number of
// listeners on signals, and don't wait for the other one to
// handle it instead of us.
emitter.count += 1;
signals = signals.filter(function (sig) {
try {
process$1.on(sig, sigListeners[sig]);
return true
} catch (er) {
return false
}
});
process$1.emit = processEmit;
process$1.reallyExit = processReallyExit;
};
signalExit.exports.load = load;
var originalProcessReallyExit = process$1.reallyExit;
var processReallyExit = function processReallyExit (code) {
/* istanbul ignore if */
if (!processOk(rollup.commonjsGlobal.process)) {
return
}
process$1.exitCode = code || /* istanbul ignore next */ 0;
emit('exit', process$1.exitCode, null);
/* istanbul ignore next */
emit('afterexit', process$1.exitCode, null);
/* istanbul ignore next */
originalProcessReallyExit.call(process$1, process$1.exitCode);
};
var originalProcessEmit = process$1.emit;
var processEmit = function processEmit (ev, arg) {
if (ev === 'exit' && processOk(rollup.commonjsGlobal.process)) {
/* istanbul ignore else */
if (arg !== undefined) {
process$1.exitCode = arg;
}
var ret = originalProcessEmit.apply(this, arguments);
/* istanbul ignore next */
emit('exit', process$1.exitCode, null);
/* istanbul ignore next */
emit('afterexit', process$1.exitCode, null);
/* istanbul ignore next */
return ret
} else {
return originalProcessEmit.apply(this, arguments)
}
};
}
const CLEAR_SCREEN = '\u001Bc';
function getResetScreen(configs, allowClearScreen) {
let clearScreen = allowClearScreen;
for (const config of configs) {
if (config.watch && config.watch.clearScreen === false) {
clearScreen = false;
}
}
if (clearScreen) {
return (heading) => loadConfigFile_js.stderr(CLEAR_SCREEN + heading);
}
let firstRun = true;
return (heading) => {
if (firstRun) {
loadConfigFile_js.stderr(heading);
firstRun = false;
}
};
}
function extractWatchHooks(command) {
if (!Array.isArray(command.watch))
return {};
return command.watch
.filter(value => typeof value === 'object')
.reduce((acc, keyValueOption) => ({ ...acc, ...keyValueOption }), {});
}
function createWatchHooks(command) {
const watchHooks = extractWatchHooks(command);
return function (hook) {
if (watchHooks[hook]) {
const cmd = watchHooks[hook];
if (!command.silent) {
loadConfigFile_js.stderr(loadConfigFile_js.cyan(`watch.${hook} ${loadConfigFile_js.bold(`$ ${cmd}`)}`));
}
try {
// !! important - use stderr for all writes from execSync
const stdio = [process.stdin, process.stderr, process.stderr];
child_process.execSync(cmd, { stdio: command.silent ? 'ignore' : stdio });
}
catch (e) {
loadConfigFile_js.stderr(e.message);
}
}
};
}
async function watch(command) {
process$2.env.ROLLUP_WATCH = 'true';
const isTTY = process$2.stderr.isTTY;
const silent = command.silent;
let watcher;
let configWatcher;
let resetScreen;
const configFile = command.config ? await cli.getConfigPath(command.config) : null;
const runWatchHook = createWatchHooks(command);
signalExit.exports(close);
process$2.on('uncaughtException', close);
if (!process$2.stdin.isTTY) {
process$2.stdin.on('end', close);
process$2.stdin.resume();
}
async function loadConfigFromFileAndTrack(configFile) {
let configFileData = null;
let configFileRevision = 0;
configWatcher = index.chokidar.watch(configFile).on('change', reloadConfigFile);
await reloadConfigFile();
async function reloadConfigFile() {
try {
const newConfigFileData = await require$$0$2.promises.readFile(configFile, 'utf8');
if (newConfigFileData === configFileData) {
return;
}
configFileRevision++;
const currentConfigFileRevision = configFileRevision;
if (configFileData) {
loadConfigFile_js.stderr(`\nReloading updated config...`);
}
configFileData = newConfigFileData;
const { options, warnings } = await loadConfigFile_js.loadAndParseConfigFile(configFile, command);
if (currentConfigFileRevision !== configFileRevision) {
return;
}
if (watcher) {
await watcher.close();
}
start(options, warnings);
}
catch (err) {
loadConfigFile_js.handleError(err, true);
}
}
}
if (configFile) {
await loadConfigFromFileAndTrack(configFile);
}
else {
const { options, warnings } = await cli.loadConfigFromCommand(command);
start(options, warnings);
}
function start(configs, warnings) {
try {
watcher = rollup.watch(configs);
}
catch (err) {
return loadConfigFile_js.handleError(err);
}
watcher.on('event', event => {
switch (event.code) {
case 'ERROR':
warnings.flush();
loadConfigFile_js.handleError(event.error, true);
runWatchHook('onError');
break;
case 'START':
if (!silent) {
if (!resetScreen) {
resetScreen = getResetScreen(configs, isTTY);
}
resetScreen(loadConfigFile_js.underline(`rollup v${rollup.version}`));
}
runWatchHook('onStart');
break;
case 'BUNDLE_START':
if (!silent) {
let input = event.input;
if (typeof input !== 'string') {
input = Array.isArray(input)
? input.join(', ')
: Object.values(input).join(', ');
}
loadConfigFile_js.stderr(loadConfigFile_js.cyan(`bundles ${loadConfigFile_js.bold(input)}${loadConfigFile_js.bold(event.output.map(rollup.relativeId).join(', '))}...`));
}
runWatchHook('onBundleStart');
break;
case 'BUNDLE_END':
warnings.flush();
if (!silent)
loadConfigFile_js.stderr(loadConfigFile_js.green(`created ${loadConfigFile_js.bold(event.output.map(rollup.relativeId).join(', '))} in ${loadConfigFile_js.bold(cli.ms(event.duration))}`));
runWatchHook('onBundleEnd');
if (event.result && event.result.getTimings) {
cli.printTimings(event.result.getTimings());
}
break;
case 'END':
runWatchHook('onEnd');
if (!silent && isTTY) {
loadConfigFile_js.stderr(`\n[${dateTime()}] waiting for changes...`);
}
}
if ('result' in event && event.result) {
event.result.close().catch(error => loadConfigFile_js.handleError(error, true));
}
});
}
async function close(code) {
process$2.removeListener('uncaughtException', close);
// removing a non-existent listener is a no-op
process$2.stdin.removeListener('end', close);
if (watcher)
await watcher.close();
if (configWatcher)
configWatcher.close();
if (code) {
process$2.exit(code);
}
}
}
exports.watch = watch;
//# sourceMappingURL=watch-cli.js.map

View file

@ -0,0 +1,307 @@
/*
@license
Rollup.js v2.80.0
Sun, 22 Feb 2026 06:16:40 GMT - commit d17ae15336a45c3c59b2a4aacac2b14186035d28
https://github.com/rollup/rollup
Released under the MIT License.
*/
'use strict';
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require$$0 = require('path');
const process = require('process');
const rollup = require('./rollup.js');
const mergeOptions = require('./mergeOptions.js');
const require$$2 = require('os');
const index = require('./index.js');
require('perf_hooks');
require('crypto');
require('fs');
require('events');
require('util');
require('stream');
class FileWatcher {
constructor(task, chokidarOptions) {
this.transformWatchers = new Map();
this.chokidarOptions = chokidarOptions;
this.task = task;
this.watcher = this.createWatcher(null);
}
close() {
this.watcher.close();
for (const watcher of this.transformWatchers.values()) {
watcher.close();
}
}
unwatch(id) {
this.watcher.unwatch(id);
const transformWatcher = this.transformWatchers.get(id);
if (transformWatcher) {
this.transformWatchers.delete(id);
transformWatcher.close();
}
}
watch(id, isTransformDependency) {
var _a;
if (isTransformDependency) {
const watcher = (_a = this.transformWatchers.get(id)) !== null && _a !== void 0 ? _a : this.createWatcher(id);
watcher.add(id);
this.transformWatchers.set(id, watcher);
}
else {
this.watcher.add(id);
}
}
createWatcher(transformWatcherId) {
const task = this.task;
const isLinux = require$$2.platform() === 'linux';
const isTransformDependency = transformWatcherId !== null;
const handleChange = (id, event) => {
const changedId = transformWatcherId || id;
if (isLinux) {
// unwatching and watching fixes an issue with chokidar where on certain systems,
// a file that was unlinked and immediately recreated would create a change event
// but then no longer any further events
watcher.unwatch(changedId);
watcher.add(changedId);
}
task.invalidate(changedId, { event, isTransformDependency });
};
const watcher = index.chokidar
.watch([], this.chokidarOptions)
.on('add', id => handleChange(id, 'create'))
.on('change', id => handleChange(id, 'update'))
.on('unlink', id => handleChange(id, 'delete'));
return watcher;
}
}
const eventsRewrites = {
create: {
create: 'buggy',
delete: null,
update: 'create'
},
delete: {
create: 'update',
delete: 'buggy',
update: 'buggy'
},
update: {
create: 'buggy',
delete: 'delete',
update: 'update'
}
};
class Watcher {
constructor(configs, emitter) {
this.buildDelay = 0;
this.buildTimeout = null;
this.invalidatedIds = new Map();
this.rerun = false;
this.running = true;
this.emitter = emitter;
emitter.close = this.close.bind(this);
this.tasks = configs.map(config => new Task(this, config));
this.buildDelay = configs.reduce((buildDelay, { watch }) => watch && typeof watch.buildDelay === 'number'
? Math.max(buildDelay, watch.buildDelay)
: buildDelay, this.buildDelay);
process.nextTick(() => this.run());
}
async close() {
if (this.buildTimeout)
clearTimeout(this.buildTimeout);
for (const task of this.tasks) {
task.close();
}
await this.emitter.emitAndAwait('close');
this.emitter.removeAllListeners();
}
invalidate(file) {
if (file) {
const prevEvent = this.invalidatedIds.get(file.id);
const event = prevEvent ? eventsRewrites[prevEvent][file.event] : file.event;
if (event === 'buggy') {
//TODO: throws or warn? Currently just ignore, uses new event
this.invalidatedIds.set(file.id, file.event);
}
else if (event === null) {
this.invalidatedIds.delete(file.id);
}
else {
this.invalidatedIds.set(file.id, event);
}
}
if (this.running) {
this.rerun = true;
return;
}
if (this.buildTimeout)
clearTimeout(this.buildTimeout);
this.buildTimeout = setTimeout(async () => {
this.buildTimeout = null;
try {
await Promise.all([...this.invalidatedIds].map(([id, event]) => this.emitter.emitAndAwait('change', id, { event })));
this.invalidatedIds.clear();
this.emitter.emit('restart');
this.emitter.removeAwaited();
this.run();
}
catch (error) {
this.invalidatedIds.clear();
this.emitter.emit('event', {
code: 'ERROR',
error,
result: null
});
this.emitter.emit('event', {
code: 'END'
});
}
}, this.buildDelay);
}
async run() {
this.running = true;
this.emitter.emit('event', {
code: 'START'
});
for (const task of this.tasks) {
await task.run();
}
this.running = false;
this.emitter.emit('event', {
code: 'END'
});
if (this.rerun) {
this.rerun = false;
this.invalidate();
}
}
}
class Task {
constructor(watcher, config) {
this.cache = { modules: [] };
this.watchFiles = [];
this.closed = false;
this.invalidated = true;
this.watched = new Set();
this.watcher = watcher;
this.skipWrite = Boolean(config.watch && config.watch.skipWrite);
this.options = mergeOptions.mergeOptions(config);
this.outputs = this.options.output;
this.outputFiles = this.outputs.map(output => {
if (output.file || output.dir)
return require$$0.resolve(output.file || output.dir);
return undefined;
});
const watchOptions = this.options.watch || {};
this.filter = rollup.createFilter(watchOptions.include, watchOptions.exclude);
this.fileWatcher = new FileWatcher(this, {
...watchOptions.chokidar,
disableGlobbing: true,
ignoreInitial: true
});
}
close() {
this.closed = true;
this.fileWatcher.close();
}
invalidate(id, details) {
this.invalidated = true;
if (details.isTransformDependency) {
for (const module of this.cache.modules) {
if (!module.transformDependencies.includes(id))
continue;
// effective invalidation
module.originalCode = null;
}
}
this.watcher.invalidate({ event: details.event, id });
}
async run() {
if (!this.invalidated)
return;
this.invalidated = false;
const options = {
...this.options,
cache: this.cache
};
const start = Date.now();
this.watcher.emitter.emit('event', {
code: 'BUNDLE_START',
input: this.options.input,
output: this.outputFiles
});
let result = null;
try {
result = await rollup.rollupInternal(options, this.watcher.emitter);
if (this.closed) {
return;
}
this.updateWatchedFiles(result);
this.skipWrite || (await Promise.all(this.outputs.map(output => result.write(output))));
this.watcher.emitter.emit('event', {
code: 'BUNDLE_END',
duration: Date.now() - start,
input: this.options.input,
output: this.outputFiles,
result
});
}
catch (error) {
if (!this.closed) {
if (Array.isArray(error.watchFiles)) {
for (const id of error.watchFiles) {
this.watchFile(id);
}
}
if (error.id) {
this.cache.modules = this.cache.modules.filter(module => module.id !== error.id);
}
}
this.watcher.emitter.emit('event', {
code: 'ERROR',
error,
result
});
}
}
updateWatchedFiles(result) {
const previouslyWatched = this.watched;
this.watched = new Set();
this.watchFiles = result.watchFiles;
this.cache = result.cache;
for (const id of this.watchFiles) {
this.watchFile(id);
}
for (const module of this.cache.modules) {
for (const depId of module.transformDependencies) {
this.watchFile(depId, true);
}
}
for (const id of previouslyWatched) {
if (!this.watched.has(id)) {
this.fileWatcher.unwatch(id);
}
}
}
watchFile(id, isTransformDependency = false) {
if (!this.filter(id))
return;
this.watched.add(id);
if (this.outputFiles.some(file => file === id)) {
throw new Error('Cannot import the generated bundle');
}
// this is necessary to ensure that any 'renamed' files
// continue to be watched following an error
this.fileWatcher.watch(id, isTransformDependency);
}
}
exports.Task = Task;
exports.Watcher = Watcher;
//# sourceMappingURL=watch.js.map

Some files were not shown because too many files have changed in this diff Show more