Skip to content

Commit 55e8144

Browse files
feat: migrate workbox-webpack-plugin to typescript (#2882)
* feat: migrate workbox-webpack-plugin to typescript * progress on typescript migration * 15e from ts lint * draft * fixing webpack version * running tests * running tests * eslint * passing tests for workbox webpack plugin * passing tests for wb wpp * passing tests for workbox webpack plugin passing tests for wb wpp cleaning imports * cleaning some eslint messages * keeping the checkConditions method signature for backward compatibility * fixing documentation * commiting package-lock * updating the webpack plugin package-lock * Fixing typescript typing issues Co-authored-by: Adriana Jara Salazar <[email protected]> Co-authored-by: Adriana Jara <[email protected]>
1 parent 10859de commit 55e8144

29 files changed

+32741
-467
lines changed

package-lock.json

Lines changed: 25582 additions & 139 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,5 @@
123123
"test_node": "gulp test_node",
124124
"test_server": "gulp test_server",
125125
"version": "gulp build && git add -A packages"
126-
},
127-
"version": "0.0.0"
126+
}
128127
}

packages/workbox-build/src/lib/populate-sw-template.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ export function populateSWTemplate({
3131
offlineGoogleAnalytics,
3232
runtimeCaching = [],
3333
skipWaiting,
34-
}: GeneratePartial & {manifestEntries: Array<ManifestEntry>}): string {
34+
}: GeneratePartial & {manifestEntries?: Array<ManifestEntry>}): string {
3535
// There needs to be at least something to precache, or else runtime caching.
36-
if (!(manifestEntries.length > 0 || runtimeCaching.length > 0)) {
36+
if (!(manifestEntries?.length > 0 || runtimeCaching.length > 0)) {
3737
throw new Error(errors['no-manifest-entries-or-runtime-caching']);
3838
}
3939

packages/workbox-build/src/schema/GenerateSWOptions.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,14 @@
467467
"QueueOptions": {
468468
"type": "object",
469469
"properties": {
470-
"onSync": {
471-
"$ref": "#/definitions/OnSyncCallback"
470+
"forceSyncFallback": {
471+
"type": "boolean"
472472
},
473473
"maxRetentionTime": {
474474
"type": "number"
475+
},
476+
"onSync": {
477+
"$ref": "#/definitions/OnSyncCallback"
475478
}
476479
},
477480
"additionalProperties": false

packages/workbox-build/src/schema/GetManifestOptions.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,11 +342,14 @@
342342
"QueueOptions": {
343343
"type": "object",
344344
"properties": {
345-
"onSync": {
346-
"$ref": "#/definitions/OnSyncCallback"
345+
"forceSyncFallback": {
346+
"type": "boolean"
347347
},
348348
"maxRetentionTime": {
349349
"type": "number"
350+
},
351+
"onSync": {
352+
"$ref": "#/definitions/OnSyncCallback"
350353
}
351354
},
352355
"additionalProperties": false

packages/workbox-build/src/schema/InjectManifestOptions.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,14 @@
357357
"QueueOptions": {
358358
"type": "object",
359359
"properties": {
360-
"onSync": {
361-
"$ref": "#/definitions/OnSyncCallback"
360+
"forceSyncFallback": {
361+
"type": "boolean"
362362
},
363363
"maxRetentionTime": {
364364
"type": "number"
365+
},
366+
"onSync": {
367+
"$ref": "#/definitions/OnSyncCallback"
365368
}
366369
},
367370
"additionalProperties": false

packages/workbox-build/src/schema/WebpackGenerateSWOptions.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,14 @@
445445
"QueueOptions": {
446446
"type": "object",
447447
"properties": {
448-
"onSync": {
449-
"$ref": "#/definitions/OnSyncCallback"
448+
"forceSyncFallback": {
449+
"type": "boolean"
450450
},
451451
"maxRetentionTime": {
452452
"type": "number"
453+
},
454+
"onSync": {
455+
"$ref": "#/definitions/OnSyncCallback"
453456
}
454457
},
455458
"additionalProperties": false

packages/workbox-build/src/schema/WebpackInjectManifestOptions.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,14 @@
345345
"QueueOptions": {
346346
"type": "object",
347347
"properties": {
348-
"onSync": {
349-
"$ref": "#/definitions/OnSyncCallback"
348+
"forceSyncFallback": {
349+
"type": "boolean"
350350
},
351351
"maxRetentionTime": {
352352
"type": "number"
353+
},
354+
"onSync": {
355+
"$ref": "#/definitions/OnSyncCallback"
353356
}
354357
},
355358
"additionalProperties": false

packages/workbox-build/src/types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,8 @@ export interface WebpackPartial {
437437
* as `webpack`'s standard `exclude` option.
438438
* If not provided, the default value is `[/\.map$/, /^manifest.*\.js$]`.
439439
*/
440-
exclude?: Array<string | RegExp | ((arg0: string) => boolean)>;
440+
//eslint-disable-next-line @typescript-eslint/ban-types
441+
exclude?: Array<string | RegExp | ((arg0: any) => boolean)>;
441442
/**
442443
* One or more chunk names whose corresponding output files should be excluded
443444
* from the precache manifest.
@@ -449,7 +450,8 @@ export interface WebpackPartial {
449450
* [the same rules](https://webpack.js.org/configuration/module/#condition)
450451
* as `webpack`'s standard `include` option.
451452
*/
452-
include?: Array<string | RegExp | ((arg0: string) => boolean)>;
453+
//eslint-disable-next-line @typescript-eslint/ban-types
454+
include?: Array<string | RegExp | ((arg0: any) => boolean)>;
453455
/**
454456
* If set to 'production', then an optimized service worker bundle that
455457
* excludes debugging info will be produced. If not explicitly configured

0 commit comments

Comments
 (0)