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

Import the bundler into the monorepo #70

Merged
merged 1,164 commits into from
Apr 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1164 commits
Select commit Hold shift + click to select a range
65123e8
Adding a guard for i.document && i.document.url because Analyzer may …
usergenic Mar 1, 2017
6d85b76
Merge pull request #443 from Polymer/absolute-paths
usergenic Mar 1, 2017
56b7bfa
Added a CHANGELOG item to address the absolute path fix.
usergenic Mar 1, 2017
1fc674a
clang-format was messing with my template indentation. Fixed.
usergenic Mar 1, 2017
4e414a5
Merge branch 'going-all-in-on-polymer-analyzer' of github.com:polymer…
usergenic Mar 1, 2017
8177d01
Merge pull request #439 from Polymer/going-all-in-on-polymer-analyzer
usergenic Mar 2, 2017
036839d
Prepare to release pre.7
rictic Mar 4, 2017
7c9e675
Update analyzer version.
rictic Mar 4, 2017
97a7334
Merge pull request #446 from Polymer/prepare-release
rictic Mar 4, 2017
279d988
Actually it's pre.8. Updated changelog.
rictic Mar 4, 2017
6d276d5
2.0.0-pre.8
rictic Mar 4, 2017
353c82d
Bumped dependency on analyzer. Updated CHANGELOG.
usergenic Mar 7, 2017
0b1844d
Added back that Unreleased item in CHANGELOG as a comment.
usergenic Mar 7, 2017
5741d96
It's 2.0.0-pre.9 -- not 8
usergenic Mar 7, 2017
257a2d6
Merge pull request #451 from Polymer/prepare-release
usergenic Mar 7, 2017
a07820e
2.0.0-pre.9
usergenic Mar 7, 2017
ac16e13
Add a sourcemap option.
ChadKillingsworth Mar 8, 2017
cd0a196
Switch back to acorn for JS tokenization
ChadKillingsworth Mar 8, 2017
9a3500d
Revert "Switch back to acorn for JS tokenization"
ChadKillingsworth Mar 9, 2017
df1f8b3
Expand sourcemap test suite and fix the bugs the new tests found.
ChadKillingsworth Mar 9, 2017
4bcbba7
Create a new ParsedHtmlDocument so as not to rely on a changed AST.
ChadKillingsworth Mar 15, 2017
0fe0db9
Switch document.inline to false as it's always a top-level document
ChadKillingsworth Mar 15, 2017
7b01849
Merge pull request #449 from ChadKillingsworth/sourcemaps-bundler
rictic Mar 15, 2017
d2da0f3
Prepare to release pre.10 (#455)
rictic Mar 15, 2017
3f873ac
clang-format
rictic Mar 15, 2017
4e54668
2.0.0-pre.10
rictic Mar 15, 2017
89e9402
Prepare to release pre.11 (#457)
rictic Mar 20, 2017
c23b6d8
2.0.0-pre.11
rictic Mar 20, 2017
6ccfb58
polymer-bundler CLI command now uses cwd as package root.
usergenic Mar 22, 2017
e3b538d
Added an execution test for polymer-bundler.
usergenic Mar 22, 2017
5592c6f
Copied appveyor.yml used in polymer-build
usergenic Mar 22, 2017
fe2d72b
Added .vscode and removed 'npm run format' from the test script.
usergenic Mar 22, 2017
66215d9
A couple of path -> path.posix changes for windows development.
usergenic Mar 22, 2017
bdbab05
npm test has better reporting than npm run test. Fixing in appveyor.yml
usergenic Mar 22, 2017
6b0946c
Merge pull request #461 from Polymer/add-appveyor
usergenic Mar 22, 2017
f7fbd6a
Merge branch 'master' into cwd-is-loader-root
usergenic Mar 22, 2017
1c8cfe6
Used && instead of ; to join commands in polymer-bundler_test.ts
usergenic Mar 24, 2017
43b91d7
fix _moveDomModuleStyleIntoTemplate
baocang Mar 30, 2017
d30bfd7
Changed the Bundler.bundle method to take a manifest from Bundler.gen…
usergenic Mar 30, 2017
6e5246c
Update the README so it's not 100% wrong.
usergenic Mar 30, 2017
05efc24
Uncommented out the ## Unreleased header in CHANGELOG.
usergenic Mar 30, 2017
ef5f4d9
Because Manifest is being exposed as part of public API, streamline i…
usergenic Mar 30, 2017
80ba798
Updated README a bit more for style and because I forgot a paragraph.
usergenic Mar 30, 2017
c26a96b
Update bundler_test.ts
baocang Mar 30, 2017
6d0b5aa
Updated jsdocs in bundler.ts to remove types.
usergenic Apr 1, 2017
6be767f
Removed another type from jsdoc.
usergenic Apr 1, 2017
d1a8810
Merge pull request #464 from Polymer/bundle-takes-manifest
usergenic Apr 1, 2017
6a8fe7e
Merge pull request #463 from baocang/master
usergenic Apr 7, 2017
5418a86
Use the get/setTemplateContent method on TreeAdapter interface to acc…
usergenic Apr 7, 2017
b72037d
Updated CHANGELOG.
usergenic Apr 7, 2017
6fb35cd
Merge branch 'master' into cwd-is-loader-root
usergenic Apr 7, 2017
20f9229
Merge pull request #466 from Polymer/fix-move-style-into-template
usergenic Apr 7, 2017
b2bbcbd
Updated polymer-analyzer to 2.0.0-alpha.35
usergenic Apr 7, 2017
3856138
Upgraded analyzer to 2.0.0-alpha.36 (BREAKING changes)
usergenic Apr 7, 2017
acdf923
Using an InMemoryOverlayUrlLoader to emulate prior analyze(url, conte…
usergenic Apr 10, 2017
e3d9957
Add link to https://github.com/Polymer/polymer-analyzer/issues/612 fo…
usergenic Apr 10, 2017
e36504a
Use a local variable to avoid obnoxious not-null assertions.
usergenic Apr 10, 2017
cdff870
Merge pull request #469 from Polymer/update-polymer-analyzer
usergenic Apr 10, 2017
22201b7
Updated the vscode whitespace settings.
usergenic Apr 10, 2017
27d15c2
Updated a bundler test because of typing related complaints.
usergenic Apr 10, 2017
5491a42
Removed explicit Analyzer production since the Bundler's constructor
usergenic Apr 10, 2017
3cede9e
Merge branch 'master' into cwd-is-loader-root
usergenic Apr 10, 2017
d12f023
Merge pull request #472 from Polymer/vscode-whitespace-settings
usergenic Apr 10, 2017
a6f2452
Merge branch 'master' into cwd-is-loader-root
usergenic Apr 10, 2017
63a569d
Updated CHANGELOG to describe the new rewriteTemplateUrlAttrs option.
usergenic Apr 11, 2017
9057f9e
Added the rewriteTemplateUrlAttrs option and updated tests.
usergenic Apr 11, 2017
1894767
Make the rewriteTemplateUrlAttrs option for most functions optional a…
usergenic Apr 11, 2017
774b515
Trim trailing whitespace on file save in vscode.
usergenic Apr 11, 2017
d49ea16
Merge pull request #476 from Polymer/more-vscode-whitespace-setting
usergenic Apr 11, 2017
48b1281
Merge branch 'master' into cwd-is-loader-root
usergenic Apr 11, 2017
5fa5785
Removed commented-out imports and vars.
usergenic Apr 11, 2017
27ede1e
Merge pull request #460 from Polymer/cwd-is-loader-root
usergenic Apr 11, 2017
e247e7b
Merge branch 'master' into rewrite-template-urls
usergenic Apr 11, 2017
28c4251
Renamed rewriteTemplateUrlAttrs to rewriteUrlsInTemplates because mor…
usergenic Apr 11, 2017
4b95d49
Sooooo, actually rewrite urls inside <style> tags.
usergenic Apr 11, 2017
ba70e51
Merge pull request #474 from Polymer/rewrite-template-urls
usergenic Apr 11, 2017
e1c5c8e
Added a parse method to ast-utils that doesn't include 'fake' nodes i…
usergenic Apr 11, 2017
58c204a
Purging the ASTs of parse5 fake nodes.
usergenic Apr 12, 2017
e173db2
Updated CHANGELOG.
usergenic Apr 12, 2017
c2b76ce
Upgraded to analyzer 2.0.0-alpha.37 and adjusted methods accordingly.
usergenic Apr 13, 2017
d76f86d
Updated CHANGELOG re: analyzer now a promise.
usergenic Apr 13, 2017
c1c18e9
Put the Redirect suite back in. Will kill that in a separate PR.
usergenic Apr 13, 2017
66d07e2
Updated CHANGELOG.md
usergenic Apr 13, 2017
918206b
Updated travis and appveyor to go Node 6 because Analyzer 2.0.0-alpha…
usergenic Apr 13, 2017
4df2cc2
Update CHANGELOG wrt node 4 support.
usergenic Apr 13, 2017
f28126f
Completed a comment that was half-done about forking.
usergenic Apr 13, 2017
3e4f483
Upgraded to Analyzer 2.0.0-alpha.38 which has a synchronous version o…
usergenic Apr 13, 2017
8b48a26
Added a TODO to port removeFakeNodes to dom5.
usergenic Apr 13, 2017
e70a99f
Added link to issue in TODO.
usergenic Apr 13, 2017
690b096
Moved to non-recursive form of the removeFakeNodes function.
usergenic Apr 13, 2017
4f862a2
Merge pull request #477 from Polymer/remove-fake-nodes
usergenic Apr 13, 2017
df4277f
Merge branch 'master' into analyzer-upgrayedd
usergenic Apr 13, 2017
2469597
WIP cleanup
usergenic Mar 29, 2017
d23bedf
Minor style update to import line in bundler_test.
usergenic Apr 13, 2017
2964cfe
Removed skipped test for redirect feature no longer supported.
usergenic Apr 13, 2017
bbcdf09
Upgraded to dom5 v2.2.0 which got rid of duplicated removeFakeNodes f…
usergenic Apr 14, 2017
fb9b9f7
Used a common node 4 support drop message in CHANGELOG.
usergenic Apr 14, 2017
dc7bdd8
Analyzer isn't a promise anymore so no await needed. Added await to …
usergenic Apr 14, 2017
56c4a16
Removed another unnecessary await
usergenic Apr 14, 2017
00221fd
Merge pull request #478 from Polymer/analyzer-upgrayedd
usergenic Apr 14, 2017
0dbe1ab
Merge remote-tracking branch 'origin/master' into spring-cleaning
usergenic Apr 14, 2017
c7b3c8d
Whitespace fix
usergenic Apr 14, 2017
79f4f3b
clang-format pinned at 1.0.49 and npm run format.
usergenic Apr 14, 2017
59e58e6
Fixing accidental lower-casing of test suite.
usergenic Apr 14, 2017
2448b7b
Updated wording in CHANGELOG
usergenic Apr 14, 2017
fe4a89b
Undo unnecessary reformatting of that simple-import.html doc.
usergenic Apr 14, 2017
8524c52
Undo unnecessary reformatting of that simple-import.html doc pt2.
usergenic Apr 14, 2017
b2b2fe5
Undo unnecessary reformatting of that simple-import.html doc pt3.
usergenic Apr 14, 2017
c52aff8
Reworded kinda confusing line at the end of the README about why we m…
usergenic Apr 14, 2017
77e4483
Reworded test names for printability.
usergenic Apr 14, 2017
fe1f98a
Reworded test names for printability. part 2
usergenic Apr 14, 2017
fd52725
Merge pull request #480 from Polymer/spring-cleaning
usergenic Apr 14, 2017
8e2e532
Updated CHANGELOG for new 2.0.0-pre.12 version.
usergenic Apr 14, 2017
b774c02
Merge pull request #481 from Polymer/prepare-release
usergenic Apr 14, 2017
b8573e1
2.0.0-pre.12
usergenic Apr 14, 2017
8a273e8
Fixed bug where exclude did not support folders.
usergenic Apr 18, 2017
f51423f
Inline Scripts and CSS by default.
usergenic Apr 18, 2017
dfdb24f
Updated CHANGELOG.
usergenic Apr 18, 2017
2c6a577
Merge branch 'exclude-as-folder' into inline-by-default
usergenic Apr 18, 2017
131d193
Simplify the enableCssInlining/enableScriptInlining default parameter…
usergenic Apr 18, 2017
4741960
Updated language dealing with the exclude option to unify description.
usergenic Apr 18, 2017
b056183
Merge pull request #484 from Polymer/exclude-as-folder
usergenic Apr 18, 2017
c31a5d8
Merge pull request #485 from Polymer/inline-by-default
usergenic Apr 18, 2017
2592d81
Added support for declarative lazy imports, i.e. <link rel=lazy-impor…
usergenic May 1, 2017
52e5607
Merge pull request #487 from Polymer/lazy-imports-up-in-here
usergenic May 1, 2017
2cd6db3
Bumped analyzer up to 2.0.0-alpha.40
usergenic May 1, 2017
157a12c
Updated CHANGELOG for release of 2.0.0-pre.13
usergenic May 1, 2017
cd346b3
Merge pull request #491 from Polymer/prepare-release-2.0.0-pre.13
usergenic May 1, 2017
52bc782
2.0.0-pre.13
usergenic May 1, 2017
daf1efa
Added methods to produce shared bundle url mappers to make it easier …
usergenic May 2, 2017
0e743d0
Merge pull request #483 from Polymer/bundle-url-mapper-functions
usergenic May 3, 2017
6dffda2
Fixed issue where lazy-import tags were being moved around just like …
usergenic May 3, 2017
f080cff
Updated CHANGELOG to mention fix for lazy-imports being moved.
usergenic May 3, 2017
eef8cb1
Merge pull request #497 from Polymer/dont-move-lazy-import-links-around
usergenic May 3, 2017
7d7bfe5
Exposing bundle url mapper and strategy generator functions right on …
usergenic May 3, 2017
b73552a
Moved strategy and urlMapper out of the generateManifest function arg…
usergenic May 3, 2017
42be74a
Merge pull request #495 from Polymer/export-stuff
usergenic May 3, 2017
cfcac60
Merge pull request #496 from Polymer/migrate-manifest-options-to-prop…
usergenic May 3, 2017
3a74daa
Updated CHANGELOG for release of 2.0.0-pre.14
usergenic May 3, 2017
88dccc5
Merge pull request #498 from Polymer/prepare-release-2.0.0-pre.14
usergenic May 3, 2017
fd0edb9
2.0.0-pre.14
usergenic May 3, 2017
5f470b3
Updated README samples to actually be valid. (Yikes they were so not…
usergenic May 4, 2017
c8c9dc9
Merge pull request #500 from Polymer/readme-fixup
usergenic May 4, 2017
4da8207
Fixed case where an inlined import's lazy-import tags were being move…
usergenic May 5, 2017
3e00344
Update CHANGELOG and upgrade analyzer for 2.0.0-pre.15 release. (#502)
usergenic May 9, 2017
765cf91
2.0.0-pre.15
usergenic May 9, 2017
7b5f43a
remove duplicate entries for inlineCss, inlineScripts and stripCommen…
a1626 May 10, 2017
bc7acd7
Fixed issue with lazy-import hrefs being adjusted during inlining. (#…
usergenic May 10, 2017
b188327
Updated CHANGELOG for 2.0.0-pre.16 release (#506)
usergenic May 10, 2017
6f4732a
2.0.0-pre.16
usergenic May 10, 2017
28680b2
Updated the `bundle()` method to return a `BundleResult`. (#508)
usergenic May 11, 2017
c469845
Updated README and CHANGELOG for the 2.0.0-pre.17 release.
usergenic May 12, 2017
06d06db
Merge pull request #509 from Polymer/prepare-release
usergenic May 12, 2017
205990f
2.0.0-pre.17
usergenic May 12, 2017
838b9fd
Updated CHANGELOG for 2.0.0-pre.18 release.
usergenic May 15, 2017
8b1d46c
Updated package.json for ^2.0.0 analyzer.
usergenic May 15, 2017
bb4b3f2
Updated an import that had moved in latest analyzer release.
usergenic May 15, 2017
6ea5e7f
Merge pull request #510 from Polymer/prepare-release
usergenic May 15, 2017
9ba7b5f
2.0.0-pre.18
usergenic May 15, 2017
12fdb06
Add failing test to show expected behaviors for url utils.
usergenic May 18, 2017
7d37762
Fix url utils case where base urls are mixed absolute/relative and th…
usergenic May 18, 2017
143f489
Updated CHANGELOG to describe bug fix.
usergenic May 18, 2017
b83afc9
Merge pull request #512 from Polymer/fix-url-utils
usergenic May 18, 2017
35ffd5c
Updated CHANGELOG for bundler 2.0.0 release.
usergenic May 18, 2017
d9d81f0
Added a celebratory emoji and message in CHANGELOG for 2.0.0 release.
usergenic May 18, 2017
484457f
Merge pull request #513 from Polymer/prepare-release-2.0.0
usergenic May 18, 2017
9c6d429
2.0.0
usergenic May 18, 2017
08c194d
Do not include the `by-polymer-bundler` hidden div in bundled files i…
usergenic May 19, 2017
d3805e8
Updated CHANGELOG for 2.0.1 release. (#515)
usergenic May 19, 2017
05269ae
2.0.1
usergenic May 19, 2017
4c555bd
Remove es6-promise from package.json.
coreyfarrell May 28, 2017
dc57cdc
Merge pull request #524 from coreyfarrell/remove-es6-promise
justinfagnani May 28, 2017
0a342dd
Remove nopt and path-posix from package.json.
coreyfarrell May 29, 2017
22f50e3
Merge pull request #526 from coreyfarrell/remove-unused
usergenic May 31, 2017
6c02f2d
Fix issue with ordering of html imports injected by shell strategy. (…
usergenic Jun 2, 2017
429e1ba
Prepared CHANGELOG for a 2.0.2 release. (#529)
usergenic Jun 2, 2017
72ccbcb
2.0.2
usergenic Jun 2, 2017
d3c58da
Fixes issues with lazy-imports, dom-modules and hidden divs #534 #535…
usergenic Jun 7, 2017
eed527f
Updated CHANGELOG for 2.0.3 release. (#538)
usergenic Jun 7, 2017
9c90a8c
2.0.3
usergenic Jun 7, 2017
0e198b4
Added `--redirect` option to `bin/polymer-bundler`. (#532)
usergenic Jun 9, 2017
0f1de37
Added a --root|-r option to set the project root when calling polymer…
usergenic Jun 10, 2017
d98978c
Update stripComments logic to include comments in template tags. (#542)
usergenic Jun 12, 2017
8ea953a
Added support to preserve important comments marked with `<!--! ... -…
usergenic Jun 12, 2017
11bbf09
Don't add the `original` property to a mapping unless one exists (#51…
usergenic Jun 13, 2017
a894f7f
Make --manifest-out work with single bundle case and include js + css…
usergenic Jun 13, 2017
c814b6d
Fix relative path rewriting to support hrefs pointing outside the pac…
usergenic Jun 14, 2017
ca1da80
Support exclusion of specific js and css files and containing folders…
usergenic Jun 14, 2017
338be1b
Update CHANGELOG for 2.1.0 release of bundler. (#554)
usergenic Jun 14, 2017
0b4dbf6
2.1.0
usergenic Jun 14, 2017
a2cc5a5
Added missing spaces in polymer-bundler CLI description.
usergenic Jun 15, 2017
c991368
Removed a space from polymer-bundler CLI description.
usergenic Jun 15, 2017
4f3df8c
Add the CI and npm badges (#557)
abdonrd Jun 15, 2017
b1d44e2
Update the handling of the `--out-dir` option. (#563)
usergenic Jun 20, 2017
68bdfe1
Ensure trailing slash (#564)
usergenic Jun 21, 2017
b462dac
Removed obsolte skipped tests and unskipped + fixed a non-obsolete sk…
usergenic Jun 27, 2017
52d6130
polymer-analyzer version mismatch stopgap. (#567)
usergenic Jun 27, 2017
11d82cf
Added a line to README about --manifest-out option (#569)
usergenic Jun 27, 2017
1b7c856
Do not inline unless options are set in CLI (#558)
jscissr Jun 27, 2017
09544f3
The code that checks for instanceof Warning is flawed because Analyze…
usergenic Jun 28, 2017
ca2b014
Don't import the shell from fragments/entrypoints. (#572)
usergenic Jun 28, 2017
57e5283
Prepare release 2.2.0 (#573)
usergenic Jun 29, 2017
935a996
2.2.0
usergenic Jun 29, 2017
f721c3b
Added a 'missingImports' set for Bundle class and output it in the ma…
usergenic Jul 7, 2017
c92e4ea
Port of logic fix from #577 (#578)
dfreedm Jul 7, 2017
222fe36
Fix invalid url-rewriting in inlined templated element style tags. (#…
usergenic Jul 12, 2017
ed78ff9
Bundle `missingImports` should not include urls matching `excludes` o…
usergenic Jul 12, 2017
b983410
Added --rewrite-urls-in-templates option to the bin/polymer-bundler C…
usergenic Jul 12, 2017
a2adbfc
Prepare release 2.3.0 (#583)
usergenic Jul 12, 2017
75a53f5
2.3.0
usergenic Jul 12, 2017
11fcdb1
Update polymer-bundler version number in package-lock.json because 'n…
usergenic Jul 13, 2017
77dbe95
Emergency release 2.3.1 (#587)
usergenic Jul 13, 2017
fd83526
2.3.1
usergenic Jul 13, 2017
446d4a6
Updated CHANGELOG because it should have the latest vulcanize items i…
usergenic Jul 14, 2017
13b4db1
Fix invalid url-rewriting in inlined templated element style tags, wi…
usergenic Jul 14, 2017
a3a2b3b
Updated CHANGELOG for a 3.0.0 polymer-bundler release. (#591)
usergenic Jul 17, 2017
3dacab4
3.0.0
usergenic Jul 17, 2017
3ed25d2
Fix --manifest-out file set for merged bundle strategy cases (like sh…
usergenic Jul 17, 2017
7272688
Update CHANGELOG for 3.0.1 release. (#594)
usergenic Jul 17, 2017
4b5dd84
3.0.1
usergenic Jul 17, 2017
4972e05
Bundler is injecting an import to the bundle file itself in some case…
usergenic Sep 22, 2017
205bae5
Inline external stylesheet links inside templates (#604)
usergenic Sep 26, 2017
d708d08
Prepare release 3.1.0 (#606)
usergenic Oct 2, 2017
83169b6
3.1.0
usergenic Oct 2, 2017
d1c5e59
Fixed deprecated CSS import links being moved into the wrong element.…
usergenic Oct 20, 2017
089a817
Prepare release 3.1.1 (#610)
usergenic Oct 21, 2017
620002d
3.1.1
usergenic Oct 21, 2017
dd928f0
4.x -> master (#619)
usergenic Dec 4, 2017
323a7b8
Put espree back in the package.json
usergenic Dec 4, 2017
320c266
Update Bundler to use Polymer Analyzer v3.0.0-pre.10 (#626)
usergenic Feb 6, 2018
744c799
Remove relativeUrl export; The Analyzer's urlResolver computes relati…
usergenic Feb 6, 2018
36b0f9a
Include the serialized document `content` in the BundleResult documen…
usergenic Feb 6, 2018
5868534
Refactor: Move all HTML-specific bundling code into new HtmlBundler c…
usergenic Feb 7, 2018
e573200
Added .type to Bundle class in preparation of JavaScript module type …
usergenic Feb 8, 2018
134f8cf
Prepare CHANGELOG for 4.0.0-pre.1 release. (#639)
usergenic Mar 7, 2018
fd719c5
4.0.0-pre.1
usergenic Mar 7, 2018
65f3f57
Upgraded to polymer-analyzer 3.0.0-pre.17 (#642)
usergenic Mar 20, 2018
7a9a5c7
Switched to FsUrlResolver from PackageUrlResolver. (#643)
usergenic Mar 20, 2018
f12aafa
Prepare CHANGELOG for 4.0.0-pre.2 release. (#644)
usergenic Mar 20, 2018
e5dc95a
4.0.0-pre.2
usergenic Mar 20, 2018
84a2e4e
Javascript Bundling Mega-PR (#637)
usergenic Mar 27, 2018
6146225
Fixed explicit undefined checks while upgrading to analyzer 3.0.0-pre…
usergenic Mar 28, 2018
181f10b
Use analyzers export features (#647)
usergenic Mar 28, 2018
0bb6efe
Prepare release 4.0.0 pre.3 (#649)
usergenic Mar 28, 2018
37e4915
4.0.0-pre.3
usergenic Mar 28, 2018
0d4322c
Update external module script tags to reference bundles. (#651)
aomarks Apr 3, 2018
ba40f7c
Prepare 4.0.0-pre.4 release. (#652)
aomarks Apr 3, 2018
15c4131
4.0.0-pre.4
aomarks Apr 3, 2018
c9391e3
Add 'packages/bundler/' from commit '15c4131b26fc156fed1c819b02ca733e…
rictic Apr 7, 2018
e21d73f
Add bundler to the workspace config.
rictic Apr 7, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/bundler/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
BasedOnStyle: Google
AlignAfterOpenBracket: AlwaysBreak
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
BinPackArguments: false
BinPackParameters: false
19 changes: 19 additions & 0 deletions packages/bundler/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
# This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
# The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
# The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
# Code distributed by Google as part of the polymer project is also
# subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt

# Polymer EditorConfig

root = true

[*]
charset = utf-8
indent_size = 2
indent_style = space
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions packages/bundler/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
16 changes: 16 additions & 0 deletions packages/bundler/.github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!--
Thanks for the PR!

If this change has a user visible change (including
bug fixes, new features, etc) please describe the change in
CHANGELOG.md.

If the change is an entirely package-internal reshuffling/refactoring
should the change not be described in the CHANGELOG.

Consider also updating the README.

More info: http://keepachangelog.com/en/0.3.0/
-->

- [ ] CHANGELOG.md has been updated
5 changes: 5 additions & 0 deletions packages/bundler/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
example/bower_components
**/.DS_Store
typings
lib
7 changes: 7 additions & 0 deletions packages/bundler/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
# npmignore
example
CHANGELOG.md
README.md
util
test
5 changes: 5 additions & 0 deletions packages/bundler/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: node_js
node_js:
- "6"
- "node"
sudo: false
14 changes: 14 additions & 0 deletions packages/bundler/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"clang-format.style": "file",
"editor.detectIndentation": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"editor.tabSize": 2,
"files.insertFinalNewline": true,
"search.exclude": {
"node_modules/": true,
"lib/": true
},
"typescript.tsdk": "node_modules/typescript/lib"
}
774 changes: 774 additions & 0 deletions packages/bundler/CHANGELOG.md

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions packages/bundler/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) 2014 The Polymer Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
172 changes: 172 additions & 0 deletions packages/bundler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
[![Build Status](https://travis-ci.org/Polymer/polymer-bundler.svg?branch=master)](https://travis-ci.org/Polymer/polymer-bundler)
[![NPM version](http://img.shields.io/npm/v/polymer-bundler.svg)](https://www.npmjs.com/package/polymer-bundler)

# Polymer Bundler

polymer-bundler is a library for packaging project assets for production to minimize network round-trips.


## Relationship to Polymer CLI

The [Polymer CLI](https://github.com/Polymer/polymer-cli) uses [polymer-build](https://github.com/Polymer/polymer-build), which uses polymer-bundler, so you can think of the CLI's build pre-configured polymer-build pipeline including polymer-bundler. Setting this up for you makes the CLI easy to use, but as a command-line wrapper its customization options are more limited. polymer-bundler allows you to completely customize your bundle strategy.

## Usage

Web pages that use multiple [HTML Imports](http://www.html5rocks.com/en/tutorials/webcomponents/imports/), external scripts, and stylesheets to load dependencies may end up making lots of network round-trips. In many cases, this can lead to long initial load times and unnecessary bandwidth usage. The polymer-bundler tool follows HTML Imports, external script and stylesheet references, inlining these external assets into "bundles", to be used in production.

In the future, technologies such as [HTTP/2](http://en.wikipedia.org/wiki/HTTP/2) and [Server Push](https://http2.github.io/faq/#whats-the-benefit-of-server-push) will likely obsolete the need for a tool like polymer-bundler for web deployment uses.


## Installation

`polymer-bundler` is available on npm. For maximium utility, `polymer-bundler` should be installed globally.

npm install -g polymer-bundler

This will install `polymer-bundler` to `/usr/local/bin/polymer-bundler` (you may need `sudo`
for this step).

## Options
- `-h`|`--help`: Print this message
- `-v`|`--version`: Print version number
- `-r`|`--root`: The root of the package/project being bundled. Defaults to the current working folder.
- `--exclude <path>`: Exclude a subpath from root. Use multiple times to exclude multiple paths. Tags (imports/scripts/etc) that reference an excluded path are left in-place, meaning the resources are not inlined. ex: `--exclude=elements/x-foo.html --exclude=elements/x-bar.html`
- `--inline-scripts`: External scripts will only be inlined if this flag is provided.
- `--inline-css`: External stylesheets will only be inlined if this flag is provided.
- `--manifest-out <path>`: If specified, the bundle manifest will be written out to `<path>`.
- `--redirect <prefix>|<path>`: Routes URLs with arbitrary `<prefix>`, possibly including a protocol, hostname, and/or path prefix to a `<path>` on local filesystem. For example `--redirect "myapp://|src"` would route `myapp://main/home.html` to `./src/main/home.html`. Multiple redirects may be specified; the earliest ones have the highest priority.
- `--rewrite-urls-in-templates`: Fix URLs found inside `<style>` tags and certain element attributes (`action`, `assetpath`, `href`, `src`, and `style`) when inside `<template>` tags. This may be necessary to bundle some Polymer 1.x projects with components that ues relative image URLs in their styles, as Polymer 1.x did not use the `assetpath` of `<dom-module>` to resolve URLs in styles like Polymer 2.x does.
- `--shell`: Uses a bundling strategy which puts inlines shared dependencies into a specified html app "shell".
- `--strip-comments`: Strips all HTML comments from the document which do not contain an `@license`, or start with `<!--#` or `<!--!`.
- `--sourcemaps`: Honor (or create) sourcemaps for inline script tags.
- `--out-file <path>`: If specified, output will be written to <path> instead of stdout.
- `--out-dir <path>`: If specified, output will be written to <path>. Necessary if bundling multiple files.

## Usage
The command

polymer-bundler target.html

will inline the HTML Imports of `target.html` and print the resulting HTML to standard output.

The command

polymer-bundler target.html --rewrite-urls-in-templates

will inline the HTML Imports of `target.html` and rewrite relative URLs encountered in style tags and element attributes to support Polymer 1.x projects which may rely on it.

The command

polymer-bundler target.html > build.html

will inline the HTML Imports of `target.html` and print the result to `build.html`.

The command

polymer-bundler -p "path/to/target/" /target.html

will inline the HTML Imports of `target.html`, treat `path/to/target/` as the webroot of target.html, and make all URLs absolute to the provided webroot.

The command

polymer-bundler --exclude "path/to/target/subpath/" --exclude "path/to/target/subpath2/" target.html

will inline the HTML Imports of `target.html` that are not in the directory `path/to/target/subpath` nor `path/to/target/subpath2`.

The command

polymer-bundler --inline-scripts target.html

will inline scripts in `target.html` as well as HTML Imports. Exclude flags will apply to both Imports and Scripts.

The command

polymer-bundler --inline-css target.html

will inline Polymerized stylesheets, `<link rel="import" type="css">`

The command

polymer-bundler --strip-comments target.html

will remove HTML comments, except for those containing `@license` or starting with `<!--#` or `<!--!`. License comments will be deduplicated.

The command

polymer-bundler --redirect "myapp://|src" target.html

will route all URLs with prefix `myapp://` to the `src` folder. So a URL like `myapp://main/index.html` would actually resolve to a file in `./src/main/index.html` relative to the package root.

## Using polymer-bundler programmatically

polymer-bundler as a library has two exported function.

`polymer-bundler` constructor takes an object of options similar to the command line options:

- `analyzer`: An instance of `polymer-analyzer` which provides analysis of and access to files to bundle. Bundler will create its own instance if this is not given.
- `excludes`: URLs to exclude from inlining. URLs may represent files or folders. HTML tags referencing excluded URLs are preserved.
- `sourcemaps`: Honor (or create) sourcemaps for inline scripts
- `inlineCss`: Will inline content of external stylesheets into the bundle html. Defaults to `true`.
- `inlineScripts`: Inline content of external scripts into the bundled html. Defaults to `true`.
- `rewriteUrlsInTemplates`: Fix URLs found inside `<style>` tags and certain element attributes (`action`, `assetpath`, `href`, `src`, and `style`) when inside `<template>` tags. This may be necessary to bundle some Polymer 1.x projects with components that ues relative image URLs in their styles, as Polymer 1.x did not use the `assetpath` of `<dom-module>` to resolve URLs in styles like Polymer 2.x does. Defaults to `false`.
- `sourcemaps`: Honor (or create) sourcemaps for inline scripts. Defaults to `false`.
- `stripComments`: Remove all HTML comments, except for `@license`, which are merely de-duplicated, server-side include directives like `<!--# ... -->`, and other important comments of the form `<!--! ... -->`. Defaults to `false`.
- `strategy`: A function that takes an array of bundles and returns an array of bundles. There are a strategy factory functions available in [bundle-manifest](https://github.com/Polymer/polymer-bundler/blob/master/src/bundle-manifest.ts).
- `urlMapper`: A function that takes bundles and returns a Map of URLs to bundles. This determines the location of generated bundles. There are URL mapper factory functions available in [bundle-manifest](https://github.com/Polymer/polymer-bundler/blob/master/src/bundle-manifest.ts)

`.generateManifest()` takes a collection of entrypoint URLs and promises a `BundleManifest` which describes all the bundles it will produce.

`.bundle()` takes a `BundleManifest` and returns a `Promise` for a `BundleResult`, which contains a map of the generated bundle html files and an updated manifest containing information on what imports were inlined for each `Bundle`.

A simple example:
```js
const bundler = new require('polymer-bundler').Bundler();
bundler.generateManifest(['my-app.html']).then((manifest) => {
bundler.bundle(manifest).then((result) => {
console.log('<!-- BUNDLED VERSION OF my-app.html: -->');
console.log(result.documents.get('my-app.html').content));
});
});
```

An example with a customized sharding strategy and output layout:
```js
const {Analyzer, FsUrlLoader} = require('polymer-analyzer');
const analyzer = new Analyzer({
urlLoader: new FsUrlLoader(path.resolve('.'))
});

const {Bundler,
generateSharedDepsMergeStrategy,
generateCountingSharedBundleUrlMapper} = require('polymer-bundler');
const bundler = new Bundler({
analyzer: analyzer,
excludes: [],
inlineScripts: true,
inlineCss: true,
rewriteUrlsInTemplates: false,
stripComments: true,
// Merge shared dependencies into a single bundle when
// they have at least three dependents.
strategy: generateSharedDepsMergeStrategy(3),
// Shared bundles will be named:
// `shared/bundle_1.html`, `shared/bundle_2.html`, etc...
urlMapper: generateCountingSharedBundleUrlMapper('shared/bundle_')
});

// Provide the strategy and the URL mapper to produce a
// manifest using custom behavior.
bundler.generateManifest(['item.html', 'cart.html']).then((manifest) => {
bundler.bundle(manifest).then((result) => {
// do stuff here with your BundleResult
});
});
```

## Caveats

In order to inlining the contents of HTML Import documents into the bundle, `polymer-bundler` has to make a few compromises to preserve valid HTML structure, script execution and style rule order:

1. Contents of all HTML Import documents will be moved to `<body>`

1. Any scripts or styles, inline or linked, which occur after a `<link rel="import">` node in `<head>` will be moved to `<body>` after the contents of the HTML Import.
21 changes: 21 additions & 0 deletions packages/bundler/appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Test against this version of Node.js
environment:
nodejs_version: "6"

# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
# install modules
- npm install

# Post-install test scripts.
test_script:
# Output useful info for debugging.
- node --version
- npm --version
# run tests
- npm test

# Don't actually build.
build: off
25 changes: 25 additions & 0 deletions packages/bundler/custom_typings/command-line-args.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
declare module 'command-line-args' {
function commandLineArgs(args: commandLineArgs.ArgDescriptor[])
: any;

module commandLineArgs {
interface ArgDescriptor {
name: string;
alias?: string;
description?: string;
defaultValue?: any;
type?: Object;
multiple?: boolean;
defaultOption?: boolean;
group?: string;
}
interface UsageOpts {
title?: string;
header?: string;
description?: string;
groups?: any;
}
}

export = commandLineArgs;
}
8 changes: 8 additions & 0 deletions packages/bundler/custom_typings/command-line-usage.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
declare module 'command-line-usage' {
function commandLineUsage(args: any)
: string;
module commandLineUsage {

}
export = commandLineUsage;
}
26 changes: 26 additions & 0 deletions packages/bundler/custom_typings/espree.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
declare module 'espree' {
interface ParseOpts2 {
ecmaVersion?: number;
loc?: boolean;
sourceType?: 'script' | 'module';
}

interface Token {
type: string,
value: string,
start: number,
end: number,
loc: {
start: {
line: number,
column: number
},
end: {
line: number,
column: number
}
}
}

export function tokenize(text: string, opts?: ParseOpts2): Token[];
}
8 changes: 8 additions & 0 deletions packages/bundler/custom_typings/mkdirp.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
declare module 'mkdirp' {
function mkdirp(args: any)
: string;
module mkdirp {
function sync(dir: string, opts?: {}): void;
}
export = mkdirp;
}
Loading