-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from SteffenBlake/integrity-broken-by-complex-…
…root-public-path fix: error when used integrity with complex root publicPath, #45
- Loading branch information
Showing
19 changed files
with
138 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/cases/integrity-publicPath-root-complex/expected/assets/css/style.bundle.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
h1 { | ||
color: red; | ||
} |
3 changes: 3 additions & 0 deletions
3
test/cases/integrity-publicPath-root-complex/expected/assets/css/vendor.bundle.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
h2 { | ||
color: green; | ||
} |
Binary file added
BIN
+1.22 KB
.../cases/integrity-publicPath-root-complex/expected/assets/img/image.697ef306.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
test/cases/integrity-publicPath-root-complex/expected/assets/js/main.bundle.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log(">> main"); |
1 change: 1 addition & 0 deletions
1
test/cases/integrity-publicPath-root-complex/expected/assets/js/no-integrity.bundle.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log(">> ignore integrity"); |
1 change: 1 addition & 0 deletions
1
test/cases/integrity-publicPath-root-complex/expected/assets/js/vendor.bundle.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log(">> vendor"); |
31 changes: 31 additions & 0 deletions
31
test/cases/integrity-publicPath-root-complex/expected/pages/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Test</title> | ||
|
||
<!-- load source style --> | ||
<link href="/test/assets/css/style.bundle.css" rel="stylesheet" integrity="sha384-gaDmgJjLpipN1Jmuc98geFnDjVqWn1fixlG0Ab90qFyUIJ4ARXlKBsMGumxTSu7E" crossorigin="use-credentials"> | ||
|
||
<!-- load source script --> | ||
<script src="/test/assets/js/main.bundle.js" defer="defer" integrity="sha384-E4IoJ3Xutt/6tUVDjvtPwDTTlCfU5oG199UoqWShFCNx6mb4tdpcPLu7sLzNc8Pe" crossorigin="use-credentials"></script> | ||
|
||
<!-- test: mixed order of css and js files --> | ||
<link href="/test/assets/css/vendor.bundle.css" rel="stylesheet" integrity="sha384-S5He9W/ycWxLrmqRI+6B4V1TOIe0rK0NKdUpD8M61yjawdrgmpxiC/EwmNGkUkcd" crossorigin="use-credentials"> | ||
<script src="/test/assets/js/vendor.bundle.js" defer="defer" integrity="sha384-KOHLjGo0rQ+C8SOiWbOw8KN2r6NlfN+E6Jlre5dqkZJLv2NCk3EzaQClYi7qJBtc" crossorigin="use-credentials"></script> | ||
|
||
<!-- test: already exists integrity attribute --> | ||
<script src="/test/assets/js/no-integrity.bundle.js" integrity="ignore me" defer="defer"></script> | ||
|
||
<!-- test: not processed script, because the attribute is invalid --> | ||
<script x-src="./not-processed-script.js" defer="defer"></script> | ||
|
||
<!-- test: not processed script, because it's loaded via url --> | ||
<script src="//cdn-script.js" defer="defer"></script> | ||
</head> | ||
<body> | ||
<h1>Hello World!</h1> | ||
|
||
<!-- load source image --> | ||
<img src="/test/assets/img/image.697ef306.png"> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions
31
test/cases/integrity-publicPath-root-complex/src/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Test</title> | ||
|
||
<!-- load source style --> | ||
<link href="./style.css" rel="stylesheet"> | ||
|
||
<!-- load source script --> | ||
<script src="./main.js" defer="defer"></script> | ||
|
||
<!-- test: mixed order of css and js files --> | ||
<link href="./vendor.css" rel="stylesheet"> | ||
<script src="./vendor.js" defer="defer"></script> | ||
|
||
<!-- test: already exists integrity attribute --> | ||
<script src="./no-integrity.js" integrity="ignore me" defer="defer"></script> | ||
|
||
<!-- test: not processed script, because the attribute is invalid --> | ||
<script x-src="./not-processed-script.js" defer="defer"></script> | ||
|
||
<!-- test: not processed script, because it's loaded via url --> | ||
<script src="//cdn-script.js" defer="defer"></script> | ||
</head> | ||
<body> | ||
<h1>Hello World!</h1> | ||
|
||
<!-- load source image --> | ||
<img src="./image.png"> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('>> main'); |
1 change: 1 addition & 0 deletions
1
test/cases/integrity-publicPath-root-complex/src/no-integrity.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('>> ignore integrity'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
h1 { | ||
color: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
h2 { | ||
color: green; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('>> vendor'); |
51 changes: 51 additions & 0 deletions
51
test/cases/integrity-publicPath-root-complex/webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const path = require('path'); | ||
const HtmlBundlerPlugin = require('../../../'); | ||
|
||
module.exports = { | ||
//mode: 'development', | ||
mode: 'production', | ||
target: 'web', | ||
|
||
output: { | ||
publicPath: '/test/', // test the root path | ||
path: path.join(__dirname, 'dist/'), | ||
crossOriginLoading: 'use-credentials', // required for test Subresource Integrity | ||
}, | ||
|
||
plugins: [ | ||
new HtmlBundlerPlugin({ | ||
entry: { | ||
//jquery: 'https://code.jquery.com/ui/1.13.2/jquery-ui.min.js', | ||
//test: the relative asset file must be the same as pathname of `compilation.assets` | ||
'pages/index': './src/index.html', | ||
}, | ||
|
||
js: { | ||
filename: 'assets/js/[name].bundle.js', | ||
}, | ||
|
||
css: { | ||
filename: 'assets/css/[name].bundle.css', | ||
}, | ||
|
||
integrity: true, // test the `true` value | ||
}), | ||
], | ||
|
||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: ['css-loader'], | ||
}, | ||
|
||
{ | ||
test: /\.(png|jpe?g|ico|svg)$/, | ||
type: 'asset/resource', | ||
generator: { | ||
filename: 'assets/img/[name].[hash:8][ext]', | ||
}, | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters