-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update parser to treat file extensions as case-insensitive (#743)
- Loading branch information
1 parent
55b9640
commit ab713a3
Showing
8 changed files
with
105 additions
and
3 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
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,3 @@ | ||
body { | ||
background: 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,17 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="index.cSs" /> | ||
</head> | ||
<body> | ||
<h1>Hello world</h1> | ||
<p>Linking to <a href="other.HTM">another page</a></p> | ||
<a href="#hash_link">Hash link</a> | ||
<a href="mailto:someone@acme.com">Mailto link</a> | ||
<a href="tel:+33636757575">Tel link</a> | ||
<script src="index.js"></script> | ||
<script src="https://unpkg.com/parcel-bundler"></script> | ||
<i>hello</i> <i>world</i> | ||
<svg><use xlink:href="icons.SVG#icon-repo-pull"></use></svg> | ||
</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 @@ | ||
alert('Hi'); |
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,10 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="index.cSs" /> | ||
</head> | ||
<body> | ||
<h1>Other page</h1> | ||
<script src="index.js"></script> | ||
</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,66 @@ | ||
const assert = require('assert'); | ||
const fs = require('fs'); | ||
const {bundle, assertBundleTree} = require('./utils'); | ||
|
||
describe('parser', function() { | ||
it('should support case-insensitive file extension', async function() { | ||
let b = await bundle( | ||
__dirname + '/integration/parser-case-insensitive-ext/index.html' | ||
); | ||
|
||
assertBundleTree(b, { | ||
name: 'index.html', | ||
assets: ['index.html'], | ||
childBundles: [ | ||
{ | ||
type: 'svg', | ||
assets: ['icons.SVG'], | ||
childBundles: [] | ||
}, | ||
{ | ||
type: 'css', | ||
assets: ['index.cSs'], | ||
childBundles: [] | ||
}, | ||
{ | ||
type: 'js', | ||
assets: ['index.js'], | ||
childBundles: [ | ||
{ | ||
type: 'map' | ||
} | ||
] | ||
}, | ||
{ | ||
type: 'html', | ||
assets: ['other.HTM'], | ||
childBundles: [ | ||
{ | ||
type: 'css', | ||
assets: ['index.cSs'], | ||
childBundles: [] | ||
}, | ||
{ | ||
type: 'js', | ||
assets: ['index.js'], | ||
childBundles: [ | ||
{ | ||
type: 'map' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}); | ||
|
||
let files = fs.readdirSync(__dirname + '/dist'); | ||
let html = fs.readFileSync(__dirname + '/dist/index.html'); | ||
for (let file of files) { | ||
let ext = file.match(/\.([0-9a-z]+)(?:[?#]|$)/i)[0]; | ||
if (file !== 'index.html' && ext !== '.map') { | ||
assert(html.includes(file)); | ||
} | ||
} | ||
}); | ||
}); |
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