-
-
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.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
50 changed files
with
291 additions
and
8 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
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
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
test/cases/integrity-publicPath-auto/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="../assets/css/style.bundle.css" rel="stylesheet" integrity="sha384-gaDmgJjLpipN1Jmuc98geFnDjVqWn1fixlG0Ab90qFyUIJ4ARXlKBsMGumxTSu7E" crossorigin="use-credentials"> | ||
|
||
<!-- load source script --> | ||
<script src="../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="../assets/css/vendor.bundle.css" rel="stylesheet" integrity="sha384-S5He9W/ycWxLrmqRI+6B4V1TOIe0rK0NKdUpD8M61yjawdrgmpxiC/EwmNGkUkcd" crossorigin="use-credentials"> | ||
<script src="../assets/js/vendor.bundle.js" defer="defer" integrity="sha384-KOHLjGo0rQ+C8SOiWbOw8KN2r6NlfN+E6Jlre5dqkZJLv2NCk3EzaQClYi7qJBtc" crossorigin="use-credentials"></script> | ||
|
||
<!-- test: already exists integrity attribute --> | ||
<script src="../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="../assets/img/image.697ef306.png"> | ||
</body> | ||
</html> |
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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: 'auto', // test empty | ||
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]', | ||
}, | ||
}, | ||
], | ||
}, | ||
}; |
3 changes: 3 additions & 0 deletions
3
test/cases/integrity-publicPath-empty/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-empty/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
test/cases/integrity-publicPath-empty/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-empty/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-empty/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-empty/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"); |
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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'); |
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'); |
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/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/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
test/cases/integrity-publicPath-root/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/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/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/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/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="/assets/css/style.bundle.css" rel="stylesheet" integrity="sha384-gaDmgJjLpipN1Jmuc98geFnDjVqWn1fixlG0Ab90qFyUIJ4ARXlKBsMGumxTSu7E" crossorigin="use-credentials"> | ||
|
||
<!-- load source script --> | ||
<script src="/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="/assets/css/vendor.bundle.css" rel="stylesheet" integrity="sha384-S5He9W/ycWxLrmqRI+6B4V1TOIe0rK0NKdUpD8M61yjawdrgmpxiC/EwmNGkUkcd" crossorigin="use-credentials"> | ||
<script src="/assets/js/vendor.bundle.js" defer="defer" integrity="sha384-KOHLjGo0rQ+C8SOiWbOw8KN2r6NlfN+E6Jlre5dqkZJLv2NCk3EzaQClYi7qJBtc" crossorigin="use-credentials"></script> | ||
|
||
<!-- test: already exists integrity attribute --> | ||
<script src="/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="/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.
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'); |
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'); |
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 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]', | ||
}, | ||
}, | ||
], | ||
}, | ||
}; |
Oops, something went wrong.