Skip to content

Commit

Permalink
chore: update lockfile
Browse files Browse the repository at this point in the history
  • Loading branch information
sodatea committed Feb 7, 2022
1 parent 37bdc0e commit 6c91e1a
Show file tree
Hide file tree
Showing 4 changed files with 3,301 additions and 3,618 deletions.
4 changes: 2 additions & 2 deletions packages/@vue/cli-service/__tests__/cors.spec.js
Expand Up @@ -30,8 +30,8 @@ test('build', async () => {
// expect(index).toMatch(/<link [^>]+app[^>]+\.css rel=preload as=style crossorigin>/)

// should apply crossorigin and add integrity to scripts and css
expect(index).toMatch(/<script defer="defer" src="\/js\/chunk-vendors\.\w{8}\.js" crossorigin integrity="sha384-.{64}\s?" type="module">/)
expect(index).toMatch(/<script defer="defer" src="\/js\/app\.\w{8}\.js" crossorigin integrity="sha384-.{64}\s?" type="module">/)
expect(index).toMatch(/<script defer="defer" type="module" src="\/js\/chunk-vendors\.\w{8}\.js" crossorigin integrity="sha384-.{64}\s?">/)
expect(index).toMatch(/<script defer="defer" type="module" src="\/js\/app\.\w{8}\.js" crossorigin integrity="sha384-.{64}\s?">/)
expect(index).toMatch(/<link href="\/css\/app\.\w{8}\.css" rel="stylesheet" crossorigin integrity="sha384-.{64}\s?">/)

// verify integrity is correct by actually running it
Expand Down
14 changes: 9 additions & 5 deletions packages/@vue/cli-service/__tests__/modernMode.spec.js
Expand Up @@ -32,8 +32,8 @@ test('modern mode', async () => {
const index = await project.read('dist/index.html')

// should use <script type="module" crossorigin="use-credentials"> for modern bundle
expect(index).toMatch(/<script defer="defer" src="\/js\/chunk-vendors\.\w{8}\.js" type="module">/)
expect(index).toMatch(/<script defer="defer" src="\/js\/app\.\w{8}\.js" type="module">/)
expect(index).toMatch(/<script defer="defer" type="module" src="\/js\/chunk-vendors\.\w{8}\.js">/)
expect(index).toMatch(/<script defer="defer" type="module" src="\/js\/app\.\w{8}\.js">/)

// should use <link rel="modulepreload" crossorigin="use-credentials"> for modern bundle
// expect(index).toMatch(/<link [^>]*js\/chunk-vendors\.\w{8}\.js" rel="modulepreload" as="script">/)
Expand All @@ -49,8 +49,8 @@ test('modern mode', async () => {
expect(stdout2).toMatch('Build complete.')
const index2 = await project.read('dist/index.html')
// should use <script type="module" crossorigin="use-credentials"> for modern bundle
expect(index2).toMatch(/<script defer="defer" src="\/js\/chunk-vendors\.\w{8}\.js" crossorigin="use-credentials" type="module">/)
expect(index2).toMatch(/<script defer="defer" src="\/js\/app\.\w{8}\.js" crossorigin="use-credentials" type="module">/)
expect(index2).toMatch(/<script defer="defer" type="module" src="\/js\/chunk-vendors\.\w{8}\.js" crossorigin="use-credentials">/)
expect(index2).toMatch(/<script defer="defer" type="module" src="\/js\/app\.\w{8}\.js" crossorigin="use-credentials">/)
// should use <link rel="modulepreload" crossorigin="use-credentials"> for modern bundle
// expect(index2).toMatch(/<link [^>]*js\/chunk-vendors\.\w{8}\.js" rel="modulepreload" as="script" crossorigin="use-credentials">/)
// expect(index2).toMatch(/<link [^>]*js\/app\.\w{8}\.js" rel="modulepreload" as="script" crossorigin="use-credentials">/)
Expand Down Expand Up @@ -133,7 +133,11 @@ test('should use correct hash for fallback bundles', async () => {
const index = await project.read('dist/index.html')
const jsFiles = (await fs.readdir(path.join(project.dir, 'dist/js'))).filter(f => f.endsWith('.js'))
for (const f of jsFiles) {
expect(index).toMatch(`<script defer="defer" src="/js/${f}"`)
if (f.includes('legacy')) {
expect(index).toMatch(`<script defer="defer" src="/js/${f}"`)
} else {
expect(index).toMatch(`<script defer="defer" type="module" src="/js/${f}"`)
}
}
})

Expand Down
22 changes: 11 additions & 11 deletions packages/@vue/cli-service/__tests__/multiPage.spec.js
Expand Up @@ -110,14 +110,14 @@ test('build w/ multi page', async () => {
const assertSharedAssets = file => {
// should split and preload vendor chunk
// expect(file).toMatch(/<link [^>]*js\/chunk-vendors[^>]*\.js" rel="preload" as="script">/)
expect(file).toMatch(/<script [^>]*src="\/js\/chunk-vendors\.\w+\.js" type="module">/)
expect(file).toMatch(/<script [^>]*type="module" src="\/js\/chunk-vendors\.\w+\.js">/)
}

const index = await project.read('dist/index.html')
assertSharedAssets(index)
// should split and preload common js and css
// expect(index).toMatch(/<link [^>]*js\/chunk-common[^>]*\.js" rel="preload" as="script">/)
expect(index).toMatch(/<script [^>]*src="\/js\/chunk-common\.\w+\.js" type="module">/)
expect(index).toMatch(/<script [^>]*type="module" src="\/js\/chunk-common\.\w+\.js">/)
expect(index).toMatch(/<link href="\/css\/chunk-common\.\w+\.css" rel="stylesheet">/)
// expect(index).toMatch(/<link [^>]*chunk-common[^>]*\.css" rel="preload" as="style">/)
// should preload correct page file
Expand All @@ -128,9 +128,9 @@ test('build w/ multi page', async () => {
// expect(index).toMatch(/<link [^>]*css\/chunk-\w+\.\w+\.css" rel="prefetch">/)
// expect(index).toMatch(/<link [^>]*js\/chunk-\w+\.\w+\.js" rel="prefetch">/)
// should load correct page js
expect(index).toMatch(/<script [^>]*src="\/js\/index\.\w+\.js" type="module">/)
expect(index).not.toMatch(/<script [^>]*src="\/js\/foo\.\w+\.js" type="module">/)
expect(index).not.toMatch(/<script [^>]*src="\/js\/bar\.\w+\.js" type="module">/)
expect(index).toMatch(/<script [^>]*type="module" src="\/js\/index\.\w+\.js">/)
expect(index).not.toMatch(/<script [^>]*type="module" src="\/js\/foo\.\w+\.js">/)
expect(index).not.toMatch(/<script [^>]*type="module" src="\/js\/bar\.\w+\.js">/)

const foo = await project.read('dist/foo.html')
assertSharedAssets(foo)
Expand All @@ -143,9 +143,9 @@ test('build w/ multi page', async () => {
// expect(foo).not.toMatch(/<link [^>]*css\/chunk-\w+\.\w+\.css" rel="prefetch">/)
// expect(foo).not.toMatch(/<link [^>]*js\/chunk-\w+\.\w+\.js" rel="prefetch">/)
// should load correct page js
expect(foo).not.toMatch(/<script [^>]*src="\/js\/index\.\w+\.js" type="module">/)
expect(foo).toMatch(/<script [^>]*src="\/js\/foo\.\w+\.js" type="module">/)
expect(foo).not.toMatch(/<script [^>]*src="\/js\/bar\.\w+\.js" type="module">/)
expect(foo).not.toMatch(/<script [^>]*type="module" src="\/js\/index\.\w+\.js">/)
expect(foo).toMatch(/<script [^>]*type="module" src="\/js\/foo\.\w+\.js">/)
expect(foo).not.toMatch(/<script [^>]*type="module" src="\/js\/bar\.\w+\.js">/)

const bar = await project.read('dist/bar.html')
assertSharedAssets(bar)
Expand All @@ -162,9 +162,9 @@ test('build w/ multi page', async () => {
// expect(bar).toMatch(/<link [^>]*css\/chunk-\w+\.\w+\.css" rel="prefetch">/)
// expect(bar).toMatch(/<link [^>]*js\/chunk-\w+\.\w+\.js" rel="prefetch">/)
// should load correct page js
expect(bar).not.toMatch(/<script [^>]*src="\/js\/index\.\w+\.js" type="module">/)
expect(bar).not.toMatch(/<script [^>]*src="\/js\/foo\.\w+\.js" type="module">/)
expect(bar).toMatch(/<script [^>]*src="\/js\/bar\.\w+\.js" type="module">/)
expect(bar).not.toMatch(/<script [^>]*type="module" src="\/js\/index\.\w+\.js" >/)
expect(bar).not.toMatch(/<script [^>]*type="module" src="\/js\/foo\.\w+\.js" >/)
expect(bar).toMatch(/<script [^>]*type="module" src="\/js\/bar\.\w+\.js">/)

// assert pages work
const port = await portfinder.getPortPromise()
Expand Down

0 comments on commit 6c91e1a

Please sign in to comment.