Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: update dependency loader-utils to v3 #21992

Merged
merged 2 commits into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
"less-loader": "10.1.0",
"license-checker": "^25.0.0",
"license-webpack-plugin": "3.0.0",
"loader-utils": "2.0.0",
"loader-utils": "3.0.0",
"magic-string": "0.25.7",
"mini-css-extract-plugin": "2.4.2",
"minimatch": "3.0.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/build_angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"less": "4.1.2",
"less-loader": "10.1.0",
"license-webpack-plugin": "3.0.0",
"loader-utils": "2.0.0",
"loader-utils": "3.0.0",
"mini-css-extract-plugin": "2.4.2",
"minimatch": "3.0.4",
"open": "8.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ describe('Browser Builder scripts array', () => {
} as {});

const fileNames = Object.keys(files);
const scriptsBundle = fileNames.find((n) => /scripts\.[0-9a-f]{20}\.js/.test(n));
const scriptsBundle = fileNames.find((n) => /scripts\.[0-9a-f]{16}\.js/.test(n));
expect(scriptsBundle).toBeTruthy();
expect(await files[scriptsBundle || '']).toMatch('var number=2;');

expect(fileNames.some((n) => /scripts\.[0-9a-f]{20}\.js\.map/.test(n))).toBeTruthy();
expect(fileNames.some((n) => /renamed-script\.[0-9a-f]{20}\.js/.test(n))).toBeTruthy();
expect(fileNames.some((n) => /renamed-script\.[0-9a-f]{20}\.js\.map/.test(n))).toBeTruthy();
expect(fileNames.some((n) => /script\.[0-9a-f]{20}\.js/.test(n))).toBeTruthy();
expect(fileNames.some((n) => /scripts\.[0-9a-f]{16}\.js\.map/.test(n))).toBeTruthy();
expect(fileNames.some((n) => /renamed-script\.[0-9a-f]{16}\.js/.test(n))).toBeTruthy();
expect(fileNames.some((n) => /renamed-script\.[0-9a-f]{16}\.js\.map/.test(n))).toBeTruthy();
expect(fileNames.some((n) => /script\.[0-9a-f]{16}\.js/.test(n))).toBeTruthy();
expect(await files['lazy-script.js']).not.toBeUndefined();
expect(await files['lazy-script.js.map']).not.toBeUndefined();
expect(await files['renamed-lazy-script.js']).not.toBeUndefined();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
expect(harness.hasFileMatch('dist', /main\.[0-9a-f]{16}\.js$/)).toBeTrue();
expect(harness.hasFileMatch('dist', /polyfills\.[0-9a-f]{16}\.js$/)).toBeTrue();
expect(harness.hasFileMatch('dist', /styles\.[0-9a-f]{16}\.css$/)).toBeTrue();
expect(harness.hasFileMatch('dist', /spectrum\.[0-9a-f]{20}\.png$/)).toBeTrue();
expect(harness.hasFileMatch('dist', /spectrum\.[0-9a-f]{16}\.png$/)).toBeTrue();
});

it(`doesn't hash any filenames when not set`, async () => {
Expand Down Expand Up @@ -94,7 +94,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
expect(harness.hasFileMatch('dist', /main\.[0-9a-f]{16}\.js$/)).toBeFalse();
expect(harness.hasFileMatch('dist', /polyfills\.[0-9a-f]{16}\.js$/)).toBeFalse();
expect(harness.hasFileMatch('dist', /styles\.[0-9a-f]{16}\.css$/)).toBeFalse();
expect(harness.hasFileMatch('dist', /spectrum\.[0-9a-f]{20}\.png$/)).toBeTrue();
expect(harness.hasFileMatch('dist', /spectrum\.[0-9a-f]{16}\.png$/)).toBeTrue();
});

it(`hashes bundles filenames only when set to "bundles"`, async () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/legacy-cli/e2e/tests/build/output-hashing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default async function () {
await expectFileToMatch('dist/test-project/index.html', /runtime\.[0-9a-f]{16}\.js/);
await expectFileToMatch('dist/test-project/index.html', /main\.[0-9a-f]{16}\.js/);
await expectFileToMatch('dist/test-project/index.html', /styles\.[0-9a-f]{16}\.(css|js)/);
await verifyMedia(/styles\.[0-9a-f]{16}\.(css|js)/, /image\.[0-9a-f]{20}\.png/);
await verifyMedia(/styles\.[0-9a-f]{16}\.(css|js)/, /image\.[0-9a-f]{16}\.png/);

await ng('build', '--output-hashing=none', '--configuration=development');
await expectFileToMatch('dist/test-project/index.html', /runtime\.js/);
Expand All @@ -29,7 +29,7 @@ export default async function () {
await expectFileToMatch('dist/test-project/index.html', /runtime\.js/);
await expectFileToMatch('dist/test-project/index.html', /main\.js/);
await expectFileToMatch('dist/test-project/index.html', /styles\.(css|js)/);
await verifyMedia(/styles\.(css|js)/, /image\.[0-9a-f]{20}\.png/);
await verifyMedia(/styles\.(css|js)/, /image\.[0-9a-f]{16}\.png/);

await ng('build', '--output-hashing=bundles', '--configuration=development');
await expectFileToMatch('dist/test-project/index.html', /runtime\.[0-9a-f]{16}\.js/);
Expand Down
26 changes: 19 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3014,6 +3014,11 @@ big.js@^5.2.2:
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==

big.js@^6.1.1:
version "6.1.1"
resolved "https://registry.yarnpkg.com/big.js/-/big.js-6.1.1.tgz#63b35b19dc9775c94991ee5db7694880655d5537"
integrity sha512-1vObw81a8ylZO5ePrtMay0n018TcftpTA5HFKDaSuiUDBo8biRBtjIobw60OpwuvrGk+FsxKamqN4cnmj/eXdg==

binary-extensions@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d"
Expand Down Expand Up @@ -6674,14 +6679,12 @@ loader-runner@^4.2.0:
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.2.0.tgz#d7022380d66d14c5fb1d496b89864ebcfd478384"
integrity sha512-92+huvxMvYlMzMt0iIOukcwYBFpkYJdpl2xsZ7LrlayO7E8SOv+JJUEK17B/dJIHAOLMfh2dZZ/Y18WgmGtYNw==

loader-utils@2.0.0, loader-utils@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.0.tgz#e4cace5b816d425a166b5f097e10cd12b36064b0"
integrity sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==
loader-utils@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-3.0.0.tgz#dfcd9d1101bc4512d4956e1d5d67577c647b47fe"
integrity sha512-ry4RE7qen73BFLgihlbyllGIW9SVWLUD5Cq9VWtzrqhntOMOJl8yEjA89d5mCUTT0puCnHo4EecO6bz+BOAS8w==
dependencies:
big.js "^5.2.2"
emojis-list "^3.0.0"
json5 "^2.1.2"
big.js "^6.1.1"

loader-utils@^1.4.0:
version "1.4.0"
Expand All @@ -6692,6 +6695,15 @@ loader-utils@^1.4.0:
emojis-list "^3.0.0"
json5 "^1.0.1"

loader-utils@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.0.tgz#e4cace5b816d425a166b5f097e10cd12b36064b0"
integrity sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==
dependencies:
big.js "^5.2.2"
emojis-list "^3.0.0"
json5 "^2.1.2"

locate-path@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e"
Expand Down