Skip to content

Commit ddec2aa

Browse files
committed
Fix tests
1 parent ec987f4 commit ddec2aa

File tree

8 files changed

+15
-27
lines changed

8 files changed

+15
-27
lines changed

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ var OfflinePlugin = (function () {
154154
if (this.appShell) {
155155
// Make appShell the latest in the chain so it could be overridden
156156
cacheMaps = (cacheMaps || []).concat({
157-
match: new Function('url', '\n if (url.pathname === location.pathname) {\n return;\n }\n\n return new URL(' + JSON.stringify(this.appShell) + ', location);\n '),
157+
match: 'function(url) {\n if (url.pathname === location.pathname) {\n return;\n }\n\n return new URL(' + JSON.stringify(this.appShell) + ', location);\n }',
158158
requestTypes: ['navigate']
159159
});
160160
}

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ export default class OfflinePlugin {
129129
if (this.appShell) {
130130
// Make appShell the latest in the chain so it could be overridden
131131
cacheMaps = (cacheMaps || []).concat({
132-
match: new Function('url', `
132+
match: `function(url) {
133133
if (url.pathname === location.pathname) {
134134
return;
135135
}
136136
137137
return new URL(${JSON.stringify(this.appShell)}, location);
138-
`),
138+
}`,
139139
requestTypes: ['navigate']
140140
});
141141
}

tests/legacy/fixtures/appshell-absolute-path/__expected/webpack2/sw.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -873,15 +873,13 @@ function logGroup(title, assets) {
873873
loaders: {},
874874
cacheMaps: [
875875
{
876-
match: function (url) {
877-
876+
match: function(url) {
878877
if (url.pathname === location.pathname) {
879878
return;
880879
}
881880

882881
return new URL("/app-shell.html", location);
883-
884-
},
882+
},
885883
to: null,
886884
requestTypes: ["navigate"],
887885
}

tests/legacy/fixtures/appshell-absolute-path/__expected/webpack3/sw.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -864,15 +864,13 @@ function logGroup(title, assets) {
864864
loaders: {},
865865
cacheMaps: [
866866
{
867-
match: function (url) {
868-
867+
match: function(url) {
869868
if (url.pathname === location.pathname) {
870869
return;
871870
}
872871

873872
return new URL("/app-shell.html", location);
874-
875-
},
873+
},
876874
to: null,
877875
requestTypes: ["navigate"],
878876
}

tests/legacy/fixtures/appshell-absolute-path/__expected/webpack4/sw.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -885,15 +885,13 @@ function logGroup(title, assets) {
885885
loaders: {},
886886
cacheMaps: [
887887
{
888-
match: function (url) {
889-
888+
match: function(url) {
890889
if (url.pathname === location.pathname) {
891890
return;
892891
}
893892

894893
return new URL("/app-shell.html", location);
895-
896-
},
894+
},
897895
to: null,
898896
requestTypes: ["navigate"],
899897
}

tests/legacy/fixtures/appshell-basic/__expected/webpack2/sw.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -873,15 +873,13 @@ function logGroup(title, assets) {
873873
loaders: {},
874874
cacheMaps: [
875875
{
876-
match: function (url) {
877-
876+
match: function(url) {
878877
if (url.pathname === location.pathname) {
879878
return;
880879
}
881880

882881
return new URL("/app-shell.html", location);
883-
884-
},
882+
},
885883
to: null,
886884
requestTypes: ["navigate"],
887885
}

tests/legacy/fixtures/appshell-basic/__expected/webpack3/sw.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -864,15 +864,13 @@ function logGroup(title, assets) {
864864
loaders: {},
865865
cacheMaps: [
866866
{
867-
match: function (url) {
868-
867+
match: function(url) {
869868
if (url.pathname === location.pathname) {
870869
return;
871870
}
872871

873872
return new URL("/app-shell.html", location);
874-
875-
},
873+
},
876874
to: null,
877875
requestTypes: ["navigate"],
878876
}

tests/legacy/fixtures/appshell-basic/__expected/webpack4/sw.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -885,15 +885,13 @@ function logGroup(title, assets) {
885885
loaders: {},
886886
cacheMaps: [
887887
{
888-
match: function (url) {
889-
888+
match: function(url) {
890889
if (url.pathname === location.pathname) {
891890
return;
892891
}
893892

894893
return new URL("/app-shell.html", location);
895-
896-
},
894+
},
897895
to: null,
898896
requestTypes: ["navigate"],
899897
}

0 commit comments

Comments
 (0)