polymer-bundler
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -11,2 +11,5 @@ # Change Log | ||
## 3.0.1 - 2017-07-17 | ||
- Fixed [issue #592](https://github.com/Polymer/polymer-bundler/issues/592) where the `--manifest-out` option of `bin/polymer-bundler` did not correctly include the basis document of shell files in inlined content list. | ||
## 3.0.0 - 2017-07-14 | ||
@@ -13,0 +16,0 @@ - BREAKING: The following changes support polymer 2.x, but will break some Polymer 1.x projects which may rely on the rewriting of relative urls within style tags. For those projects, set the `rewriteUrlsInTemplates` option to `true` or use `--rewriteUrlsInTemplates` at command-line. |
@@ -204,23 +204,14 @@ #!/usr/bin/env node | ||
for (const [url, bundle] of manifest.bundles) { | ||
json[url] = [ | ||
...bundle.inlinedHtmlImports, | ||
...bundle.inlinedScripts, | ||
...bundle.inlinedStyles | ||
]; | ||
json[url] = [...new Set([ | ||
// `files` and `inlinedHtmlImports` will be partially duplicative, but use | ||
// of both ensures the basis document for a file is included since there | ||
// is no other specific property that currently expresses it. | ||
...bundle.files, | ||
...bundle.inlinedHtmlImports, | ||
...bundle.inlinedScripts, | ||
...bundle.inlinedStyles | ||
])]; | ||
for (const missingImport of bundle.missingImports) { | ||
missingImports.add(missingImport); | ||
} | ||
if (bundle.entrypoints.size > 1) { | ||
continue; | ||
} | ||
// Include the entrypoint in the manifest where bundle has just one | ||
// entrypoint, since we know this is the document that was the basis for the | ||
// bundle. | ||
// TODO(usergenic): Extend Bundle with a basis document property to provide | ||
// a more conventional means to get at this. | ||
for (const entrypoint of bundle.entrypoints) { | ||
if (!bundle.inlinedHtmlImports.has(entrypoint)) { | ||
json[url].unshift(entrypoint); | ||
} | ||
} | ||
} | ||
@@ -227,0 +218,0 @@ if (missingImports.size > 0) { |
@@ -107,2 +107,34 @@ "use strict"; | ||
})); | ||
test('manifest includes all files including basis', () => __awaiter(this, void 0, void 0, function* () { | ||
const projectRoot = path.resolve(__dirname, '../../test/html/imports'); | ||
const tempdir = fs.mkdtempSync(path.join(os.tmpdir(), ' ').trim()); | ||
const manifestPath = path.join(tempdir, 'bundle-manifest.json'); | ||
child_process_1.execSync(`cd ${projectRoot} && ` + | ||
`node ${cliPath} --inline-scripts --inline-css ` + | ||
`--in-html eagerly-importing-a-fragment.html ` + | ||
`--in-html importing-fragments/fragment-a.html ` + | ||
`--in-html importing-fragments/fragment-b.html ` + | ||
`--in-html importing-fragments/shell.html ` + | ||
`--shell importing-fragments/shell.html ` + | ||
`--out-dir ${tempdir}/bundled/ ` + | ||
`--manifest-out ${manifestPath}`) | ||
.toString(); | ||
const manifestJson = fs.readFileSync(manifestPath).toString(); | ||
const manifest = JSON.parse(manifestJson); | ||
assert.deepEqual(manifest, { | ||
'eagerly-importing-a-fragment.html': [ | ||
'eagerly-importing-a-fragment.html', | ||
], | ||
'importing-fragments/fragment-a.html': [ | ||
'importing-fragments/fragment-a.html', | ||
], | ||
'importing-fragments/fragment-b.html': [ | ||
'importing-fragments/fragment-b.html', | ||
], | ||
'importing-fragments/shell.html': [ | ||
'importing-fragments/shell.html', | ||
'importing-fragments/shared-util.html', | ||
], | ||
}); | ||
})); | ||
}); | ||
@@ -109,0 +141,0 @@ suite('--redirect', () => { |
{ | ||
"name": "polymer-bundler", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Process Web Components into one output file", | ||
@@ -5,0 +5,0 @@ "main": "lib/bundler.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
409902
4802