Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 2 additions & 22 deletions aio/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,7 @@
"src/assets",
"src/generated",
"src/pwa-manifest.json",
"src/google385281288605d160.html",
{
"glob": "native-shim.js",
"input": "node_modules/@webcomponents/custom-elements/src",
"output": "/assets/js"
},
{
"glob": "es.reflect.construct.js",
"input": "node_modules/core-js/modules",
"output": "/assets/js"
}
"src/google385281288605d160.html"
],
"styles": [
"src/styles/main.scss"
Expand Down Expand Up @@ -156,17 +146,7 @@
"src/assets",
"src/generated",
"src/pwa-manifest.json",
"src/google385281288605d160.html",
{
"glob": "native-shim.js",
"input": "node_modules/@webcomponents/custom-elements/src",
"output": "/assets/js"
},
{
"glob": "es.reflect.construct.js",
"input": "node_modules/core-js/modules",
"output": "/assets/js"
}
"src/google385281288605d160.html"
],
"styles": [
"src/styles/main.scss"
Expand Down
5 changes: 1 addition & 4 deletions aio/ngsw-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
"/assets/js/*.js",
"/*.css",
"/*.js",
"!/assets/js/es.reflect.construct.js",
"!/assets/js/native-shim.js",
"!/*-es5*.js"
],
"urls": [
Expand All @@ -41,8 +39,7 @@
"resources": {
"files": [
"/assets/images/favicons/**",
"/assets/js/es.reflect.construct.js",
"/assets/js/native-shim.js",
"/generated/js/custom-elements-es5-polyfills.js",
"/*-es5*.js",
"!/**/_unused/**"
]
Expand Down
5 changes: 5 additions & 0 deletions aio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@
"~~audit-web-app": "node scripts/audit-web-app",
"~~check-env": "node scripts/check-environment",
"~~clean-generated": "node --eval \"require('shelljs').rm('-rf', 'src/generated')\"",
"pre~~build": "yarn ~~build-ce-es5-polyfills",
"~~build": "ng build --configuration=stable",
"post~~build": "yarn build-404-page",
"~~build-ce-es5-polyfills": "esbuild src/custom-elements-es5-polyfills.js --bundle --minify | swc --config=minify=true --filename=custom-elements-es5-polyfills.js --out-file=src/generated/js/custom-elements-es5-polyfills.js --no-swcrc",
"~~light-server": "light-server --bind=localhost --historyindex=/index.html --no-reload"
},
"//engines-comment": "Keep this in sync with /package.json and /aio/tools/examples/shared/package.json",
Expand Down Expand Up @@ -109,6 +111,8 @@
"@angular-devkit/build-angular": "0.1102.2",
"@angular/cli": "11.2.2",
"@angular/compiler-cli": "11.2.3",
"@swc/cli": "^0.1.35",
"@swc/core": "^1.2.50",
"@types/jasmine": "~3.6.0",
"@types/lunr": "^2.3.2",
"@types/node": "^12.7.9",
Expand All @@ -124,6 +128,7 @@
"dgeni": "^0.4.13",
"dgeni-packages": "^0.28.4",
"entities": "^1.1.1",
"esbuild": "^0.9.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yet more dependencies! Was this not possible with some of the tools that we already depend upon, like Babel and webpack?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't directly depend on Babel or Webpack in AIO 🤷‍♂️
So, if we are going to add new direct dependencies, it is so much cooler (and probably faster) to use state of the art tools, such as esbuild and swc 💪 😛

"eslint": "^3.19.0",
"eslint-plugin-jasmine": "^2.2.0",
"find-free-port": "^2.0.0",
Expand Down
8 changes: 7 additions & 1 deletion aio/src/app/custom-elements/code/code-tabs.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,17 @@ export class CodeTabsComponent implements OnInit, AfterViewInit {
this.tabs = [];
const contentElem = this.content.nativeElement;
const codeExamples = Array.from(contentElem.querySelectorAll('code-pane'));
contentElem.innerHTML = ''; // Remove DOM nodes that are no longer needed.

for (const tabContent of codeExamples) {
this.tabs.push(this.getTabInfo(tabContent));
}

// Remove DOM nodes that are no longer needed.
//
// NOTE:
// In IE11, doing this also empties the `<code-pane>` nodes captured in `codeExamples` ¯\_(ツ)_/¯
// Only remove the unnecessary nodes after having captured the `<code-pane>` contents.
contentElem.innerHTML = '';
}

ngAfterViewInit() {
Expand Down
4 changes: 2 additions & 2 deletions aio/src/assets/images/logos/angularjs/AngularJS-Shield.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions aio/src/custom-elements-es5-polyfills.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Custom Elements polyfills for browsers that natively support Custom Elements but not ES2015
* modules.
*
* NOTE:
* Chrome, Firefox and Safari should not need these, because they added support for ES2015 modules
* before Custom Elements. It is still required for some other (less common) browsers:
* - UC browser for android 11.8 (~3.5% global usage)
* - Samsung browser 5.0-8.1 (~0.43% global usage)
* - Opera 41-47 (~0.02% global usage)
*/
// @ts-nocheck

require('core-js/modules/es.reflect.construct'); // Required by `native-shim.js`.
require('@webcomponents/custom-elements/src/native-shim');
18 changes: 9 additions & 9 deletions aio/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@ <h2 style="color: red; margin-top: 40px; position: relative; text-align: center;
</noscript>

<!--
Custom Element ES5 shim. Required for browsers that natively support Custom Elements, but do not
support ES2015 modules.
NOTE: Chrome, Firefox and Safari should not need this, because they added support for ES2015
modules before Custom Elements. It is still required for some other (less common) browsers:
- UC browser for android 11.8 (~3.5% global usage)
- Samsung browser 5.0-8.1 (~0.43% global usage)
- Opera 41-47 (~0.02% global usage)
Custom Elements polyfills required for browsers that natively support Custom Elements but not
ES2015 modules. (See `custom-elements-es5-polyfills.js` for more info.)

NOTE:
The polyfills here will be loaded before the ones in `polyfills.ts` (including
`@webcomponents/custom-elements`). This is fine, because the polyfills here are only needed on
browsers that natively support Custom Elements, on which `@webcomponents/custom-elements` will
be a no-op (so the order of loading does not matter).
-->
<script src="assets/js/es.reflect.construct.js" nomodule></script>;
<script src="assets/js/native-shim.js" nomodule></script>;
<script src="generated/js/custom-elements-es5-polyfills.js" nomodule></script>

</body>

Expand Down
2 changes: 2 additions & 0 deletions aio/src/styles/1-layouts/_content-layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
}

.sidenav-content {
display: block; // This is required for browsers that do not recognize `<main>` as a block
// element (such as IE11).
Comment on lines +7 to +8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you not fix this generically by adding a rule like?

main {
  display: block;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I could (but since we don't have (nor is it very likely to have) another <main> element in AIO, either way should be fine).

Of course, a rule targeting main would be more robust against potential future additions of <main> elements, but equally the current rule is more robust against changing .sidenav-content to a <section> or <article> element 🤔

Both are unlikely to happen (esp. before we drop support for IE11), so I went with the least amount of loc 😁
Happy to go the other way, if you like it better.

min-height: 100vh;
padding: 80px 3rem 2rem;
max-width: 50em;
Expand Down
2 changes: 2 additions & 0 deletions aio/src/styles/2-modules/_features.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
.feature-row {
display: flex;
flex-wrap: wrap;
justify-content: space-around; // This is required for browsers that do not support
// `space-evenly` (such as IE11).
justify-content: space-evenly;

@media (max-width: 1057px) {
Expand Down
108 changes: 105 additions & 3 deletions aio/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,11 @@
call-me-maybe "^1.0.1"
glob-to-regexp "^0.3.0"

"@napi-rs/triples@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@napi-rs/triples/-/triples-1.0.2.tgz#2ce4c6a78568358772008f564ee5009093d20a19"
integrity sha512-EL3SiX43m9poFSnhDx4d4fn9SSaqyO2rHsCNhETi9bWPmjXK3uPJ0QpPFtx39FEdHcz1vJmsiW41kqc0AgvtzQ==

"@ngtools/webpack@11.2.2":
version "11.2.2"
resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-11.2.2.tgz#647862ed19761796c7f84d5fb3305661d2a3af67"
Expand All @@ -1612,6 +1617,14 @@
enhanced-resolve "5.7.0"
webpack-sources "2.2.0"

"@node-rs/helper@^1.0.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@node-rs/helper/-/helper-1.1.0.tgz#4fcbbebae3b81932d1ff3e431c7cd3886b504742"
integrity sha512-r43YnnrY5JNzDuXJdW3sBJrKzvejvFmFWbiItUEoBJsaPzOIWFMhXB7i5j4c9EMXcFfxveF4l7hT+rLmwtjrVQ==
dependencies:
"@napi-rs/triples" "^1.0.2"
tslib "^2.1.0"

"@nodelib/fs.scandir@2.1.3":
version "2.1.3"
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b"
Expand Down Expand Up @@ -1778,6 +1791,80 @@
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea"
integrity sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==

"@swc/cli@^0.1.35":
version "0.1.35"
resolved "https://registry.yarnpkg.com/@swc/cli/-/cli-0.1.35.tgz#e939fd374e889e3329ebdc48988e9e489d06f002"
integrity sha512-jjgfm8s+ueNAS8QaStpEXctn0O0AVfRR1vAocsFQyLysQkmbsnp8OyajaKgaLSUsdf4ZWlF8pKATPUPp869UEQ==
dependencies:
commander "^7.1.0"
convert-source-map "^1.6.0"
glob "^7.1.3"
lodash "^4.17.21"
slash "3.0.0"
source-map "^0.7.3"

"@swc/core-android-arm64@^1.2.50":
version "1.2.50"
resolved "https://registry.yarnpkg.com/@swc/core-android-arm64/-/core-android-arm64-1.2.50.tgz#763e5ad1a899e2ff0a914c8ac8134e573d8dc733"
integrity sha512-aPJGhHqRkNncZnG5fCRhdX9JHGQ7SJBykm7ER/F6nNuvuSTYbuv4wGLYzNVi2UmeSMQQH/9j1D5xcX8STGIgsw==

"@swc/core-darwin-arm64@^1.2.50":
version "1.2.50"
resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.2.50.tgz#1ed630edef1b8864d3793e4133988b7281511239"
integrity sha512-ginmLsDGswvaENSDxhevBpq63iKAxKtVS0P53b9KvfOhRDtQpnXMIxc3iYeyII8D2QDR0HOQu/c1n2b6sUIuBQ==

"@swc/core-darwin-x64@^1.2.50":
version "1.2.50"
resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.2.50.tgz#2e794feb5071cf4e7e20cedde872f4dfb77cd031"
integrity sha512-HJ2CFuzxIXwoo22jHr1ntuveqoHN0hbY7mUTXaRLWh9468TMeGmD20rm7l9FnOsBVH9m9psHGpOVNOUSEXg6tw==

"@swc/core-linux-arm-gnueabihf@^1.2.50":
version "1.2.50"
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.2.50.tgz#c7b9e2b35c7d9997004d6138c1c8115e14744cb7"
integrity sha512-y1rsaqmbO/rezCifX30ilqTKaeN4yp0pDpHri6hAMKqHOzNGZTrY7p3nmiCd425gFVpM72gcGNrDqbt9IqeOPA==

"@swc/core-linux-arm64-gnu@^1.2.50":
version "1.2.50"
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.2.50.tgz#1f41ac1fae0438641773098f254c9e1d72563d1f"
integrity sha512-eh1xpvPNoXiZBrkKLoM1JDXAH5U7zK+kebC7lXsPjPuPVGENfknAoT3oQvyohWnE7pf1nOPBiDX7wOT4T2e1Pw==

"@swc/core-linux-x64-gnu@^1.2.50":
version "1.2.50"
resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.2.50.tgz#57ca45b5b5e67a12ff90b5f50a23559be65840e6"
integrity sha512-2I5OX66FQejeiJ4fuPS18AQieVk6H8Z2LfOgCuDMK2ZRQdc3gBe1rYVhZyCGdYXQ76mUlo6+phSy5qI63d172Q==

"@swc/core-linux-x64-musl@^1.2.50":
version "1.2.50"
resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.2.50.tgz#c9225ec94618e75a5260264db7cd3122930e68f1"
integrity sha512-370yPM7+8tzEdiV3Y+RzkzukRfYeDiOS6oRCtpTqGmfh9RUhxyKQFM/gYRi77Qpgq6LnvY1eUQh+WrioCAztXg==

"@swc/core-win32-ia32-msvc@^1.2.50":
version "1.2.50"
resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.2.50.tgz#8aca2e009d49f2cff44fe924115104565ce59d5c"
integrity sha512-sQOXq79ge8Bv07rh1bHZwiH5qXg8do28HdzhI8/VaFAh3K+8zTqOdF9DuOlf0Z/sE23znbbQcp3Hz30+5jhgWg==

"@swc/core-win32-x64-msvc@^1.2.50":
version "1.2.50"
resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.2.50.tgz#383ac624bdf0d7865013c6482392319afe2e8462"
integrity sha512-NmxSnkj7PYkN+e060tf0LR7knrdCzUobSmQrMwWlaC5dACHREFlo00mocL8AwB3WOZKvNp4MQv1cH3EaGbIpKw==

"@swc/core@^1.2.50":
version "1.2.50"
resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.2.50.tgz#d70daed948c9bb0ba8084e804e7fb2b1fcf0e19c"
integrity sha512-v4geRnqPqNBOAhWIT0ntcbw09mOxNy5XaGp4Nulxefpdpr8QUxPa1/9fLRPAbYjojT8yiqDtcLdx+yk+stFhpA==
dependencies:
"@node-rs/helper" "^1.0.0"
optionalDependencies:
"@swc/core-android-arm64" "^1.2.50"
"@swc/core-darwin-arm64" "^1.2.50"
"@swc/core-darwin-x64" "^1.2.50"
"@swc/core-linux-arm-gnueabihf" "^1.2.50"
"@swc/core-linux-arm64-gnu" "^1.2.50"
"@swc/core-linux-x64-gnu" "^1.2.50"
"@swc/core-linux-x64-musl" "^1.2.50"
"@swc/core-win32-ia32-msvc" "^1.2.50"
"@swc/core-win32-x64-msvc" "^1.2.50"

"@szmarczak/http-timer@^1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421"
Expand Down Expand Up @@ -3950,6 +4037,11 @@ commander@^4.0.1:
resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068"
integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==

commander@^7.1.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-7.1.0.tgz#f2eaecf131f10e36e07d894698226e36ae0eb5ff"
integrity sha512-pRxBna3MJe6HKnBGsDyMv8ETbptw3axEdYHoqNh7gu5oDcew8fs0xnivZGm06Ogk8zGAJ9VX+OPEr2GXEQK4dg==

commondir@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
Expand Down Expand Up @@ -4113,7 +4205,7 @@ content-type@^1.0.4, content-type@~1.0.4:
resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b"
integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==

convert-source-map@1.7.0, convert-source-map@^1.5.1, convert-source-map@^1.7.0:
convert-source-map@1.7.0, convert-source-map@^1.5.1, convert-source-map@^1.6.0, convert-source-map@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442"
integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==
Expand Down Expand Up @@ -5391,6 +5483,11 @@ es6-weak-map@^2.0.1, es6-weak-map@^2.0.2:
es6-iterator "^2.0.3"
es6-symbol "^3.1.1"

esbuild@^0.9.0:
version "0.9.0"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.9.0.tgz#b8320df85048ed1637c6b59ee52abba248936d3c"
integrity sha512-IqYFO7ZKHf0y4uJpJfGqInmSRn8jMPMbyI1W0Y2PSjSjJcVP538tC8TleJAS4Y8QeqwajqBTwFKayWVzYlMIgg==

escalade@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
Expand Down Expand Up @@ -8708,6 +8805,11 @@ lodash@^4.17.19:
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==

lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

log-symbols@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a"
Expand Down Expand Up @@ -12337,7 +12439,7 @@ simple-swizzle@^0.2.2:
dependencies:
is-arrayish "^0.3.1"

slash@^3.0.0:
slash@3.0.0, slash@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==
Expand Down Expand Up @@ -13490,7 +13592,7 @@ ts-pnp@^1.1.6:
resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92"
integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==

tslib@2.1.0:
tslib@2.1.0, tslib@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a"
integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==
Expand Down