diff --git a/functions/package-lock.json b/functions/package-lock.json index 9c8517c..5015641 100644 --- a/functions/package-lock.json +++ b/functions/package-lock.json @@ -97,6 +97,14 @@ "@babel/types": "^7.0.0" } }, + "@babel/helper-module-imports": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz", + "integrity": "sha512-aP/hlLq01DWNEiDg4Jn23i+CXxW/owM4WpDLFUbpjxe4NS3BhLVZQ5i7E0ZrxuQ/vwekIeciyamgB1UIYxxM6A==", + "requires": { + "@babel/types": "^7.0.0" + } + }, "@babel/helper-optimise-call-expression": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz", @@ -246,6 +254,86 @@ "to-fast-properties": "^2.0.0" } }, + "@emotion/cache": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-10.0.0.tgz", + "integrity": "sha512-1/sT6GNyvWmxCtJek8ZDV+b+a+NMDx8/61UTnnF3rqrTY7bLTjw+fmXO7WgUIH0owuWKxza/J/FfAWC/RU4G7A==", + "requires": { + "@emotion/sheet": "0.9.2", + "@emotion/stylis": "0.8.3", + "@emotion/utils": "0.11.1", + "@emotion/weak-memoize": "0.2.2" + } + }, + "@emotion/core": { + "version": "10.0.6", + "resolved": "https://registry.npmjs.org/@emotion/core/-/core-10.0.6.tgz", + "integrity": "sha512-S5KkrodTKby1S6pKZnH8LzjzlebHvjactujfVzzu/mYYdVdKYegJuJdrAz3m9zhIeizzeQGD8xWF490ioGpUtw==", + "requires": { + "@emotion/cache": "10.0.0", + "@emotion/css": "^10.0.6", + "@emotion/serialize": "^0.11.3", + "@emotion/sheet": "0.9.2", + "@emotion/utils": "0.11.1" + } + }, + "@emotion/css": { + "version": "10.0.6", + "resolved": "https://registry.npmjs.org/@emotion/css/-/css-10.0.6.tgz", + "integrity": "sha512-/suYOvP0zeKC3UNoIeN/3zvr/ghUKgfWx0Pht5ZY9qgHis68fB+V45OjonzMbdOw4mGX0vjZzJhINk9JbRWVrg==", + "requires": { + "@emotion/serialize": "^0.11.3", + "@emotion/utils": "0.11.1", + "babel-plugin-emotion": "^10.0.6" + } + }, + "@emotion/hash": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.7.1.tgz", + "integrity": "sha512-OYpa/Sg+2GDX+jibUfpZVn1YqSVRpYmTLF2eyAfrFTIJSbwyIrc+YscayoykvaOME/wV4BV0Sa0yqdMrgse6mA==" + }, + "@emotion/memoize": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.1.tgz", + "integrity": "sha512-Qv4LTqO11jepd5Qmlp3M1YEjBumoTHcHFdgPTQ+sFlIL5myi/7xu/POwP7IRu6odBdmLXdtIs1D6TuW6kbwbbg==" + }, + "@emotion/serialize": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-0.11.3.tgz", + "integrity": "sha512-6Q+XH/7kMdHwtylwZvdkOVMydaGZ989axQ56NF7urTR7eiDMLGun//pFUy31ha6QR4C6JB+KJVhZ3AEAJm9Z1g==", + "requires": { + "@emotion/hash": "0.7.1", + "@emotion/memoize": "0.7.1", + "@emotion/unitless": "0.7.3", + "@emotion/utils": "0.11.1", + "csstype": "^2.5.7" + } + }, + "@emotion/sheet": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-0.9.2.tgz", + "integrity": "sha512-pVBLzIbC/QCHDKJF2E82V2H/W/B004mDFQZiyo/MSR+VC4pV5JLG0TF/zgQDFvP3fZL/5RTPGEmXlYJBMUuJ+A==" + }, + "@emotion/stylis": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/@emotion/stylis/-/stylis-0.8.3.tgz", + "integrity": "sha512-M3nMfJ6ndJMYloSIbYEBq6G3eqoYD41BpDOxreE8j0cb4fzz/5qvmqU9Mb2hzsXcCnIlGlWhS03PCzVGvTAe0Q==" + }, + "@emotion/unitless": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.3.tgz", + "integrity": "sha512-4zAPlpDEh2VwXswwr/t8xGNDGg8RQiPxtxZ3qQEXyQsBV39ptTdESCjuBvGze1nLMVrxmTIKmnO/nAV8Tqjjzg==" + }, + "@emotion/utils": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-0.11.1.tgz", + "integrity": "sha512-8M3VN0hetwhsJ8dH8VkVy7xo5/1VoBsDOk/T4SJOeXwTO1c4uIqVNx2qyecLFnnUWD5vvUqHQ1gASSeUN6zcTg==" + }, + "@emotion/weak-memoize": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.2.tgz", + "integrity": "sha512-n/VQ4mbfr81aqkx/XmVicOLjviMuy02eenSdJY33SVA7S2J42EU0P1H0mOogfYedb3wXA0d/LVtBrgTSm04WEA==" + }, "@firebase/app": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.3.5.tgz", @@ -659,6 +747,14 @@ "color-convert": "^1.9.0" } }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "requires": { + "sprintf-js": "~1.0.2" + } + }, "arr-diff": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", @@ -772,6 +868,37 @@ "is-buffer": "^1.1.5" } }, + "babel-plugin-emotion": { + "version": "10.0.6", + "resolved": "https://registry.npmjs.org/babel-plugin-emotion/-/babel-plugin-emotion-10.0.6.tgz", + "integrity": "sha512-JD2st8enZJn8h7W1s8kcb40r3RBCJwV9E8ZAhyyhELUMP8OYwyI9K1rz7MxRi0CoorX15kVo2NXZ+OJ6CeMY8A==", + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "@emotion/hash": "0.7.1", + "@emotion/memoize": "0.7.1", + "@emotion/serialize": "^0.11.3", + "babel-plugin-macros": "^2.0.0", + "babel-plugin-syntax-jsx": "^6.18.0", + "convert-source-map": "^1.5.0", + "escape-string-regexp": "^1.0.5", + "find-root": "^1.1.0", + "source-map": "^0.5.7" + } + }, + "babel-plugin-macros": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-2.4.5.tgz", + "integrity": "sha512-+/9yteNQw3yuZ3krQUfjAeoT/f4EAdn3ELwhFfDj0rTMIaoHfIdrcLePOfIaL0qmFLpIcgPIL2Lzm58h+CGWaw==", + "requires": { + "cosmiconfig": "^5.0.5", + "resolve": "^1.8.1" + } + }, + "babel-plugin-syntax-jsx": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz", + "integrity": "sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY=" + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -1068,6 +1195,27 @@ "resolved": "https://registry.npmjs.org/call-signature/-/call-signature-0.0.2.tgz", "integrity": "sha1-qEq8glpV70yysCi9dOIFpluaSZY=" }, + "caller-callsite": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", + "integrity": "sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ=", + "requires": { + "callsites": "^2.0.0" + } + }, + "caller-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz", + "integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=", + "requires": { + "caller-callsite": "^2.0.0" + } + }, + "callsites": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=" + }, "camelcase": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", @@ -1305,6 +1453,17 @@ "vary": "^1" } }, + "cosmiconfig": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.0.7.tgz", + "integrity": "sha512-PcLqxTKiDmNT6pSpy4N6KtuPwb53W+2tzNvwOZw0WH9N6O0vLIBq0x8aj8Oj75ere4YcGi48bDFCL+3fRJdlNA==", + "requires": { + "import-fresh": "^2.0.0", + "is-directory": "^0.3.1", + "js-yaml": "^3.9.0", + "parse-json": "^4.0.0" + } + }, "create-error-class": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", @@ -1335,6 +1494,11 @@ "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.2.tgz", "integrity": "sha512-wan8dMWQ0GUeF7DGEPVjhHemVW/vy6xUYmFzRY8RYqgA0JtXC9rJmbScBjqSu6dg9q0lwPQy6ZAmJVr3PPTvqQ==" }, + "csstype": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.1.tgz", + "integrity": "sha512-wv7IRqCGsL7WGKB8gPvrl+++HlFM9kxAM6jL1EXNPNTshEJYilMkbfS2SnuHha77uosp/YVK0wAp2jmlBzn1tg==" + }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -1608,6 +1772,14 @@ "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "requires": { + "is-arrayish": "^0.2.1" + } + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -1618,6 +1790,11 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + }, "espurify": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/espurify/-/espurify-1.8.1.tgz", @@ -1892,6 +2069,11 @@ } } }, + "find-root": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", + "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==" + }, "firebase-admin": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/firebase-admin/-/firebase-admin-6.0.0.tgz", @@ -2846,6 +3028,15 @@ "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==" }, + "import-fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz", + "integrity": "sha1-2BNVwVYS04bGH53dOSLUMEgipUY=", + "requires": { + "caller-path": "^2.0.0", + "resolve-from": "^3.0.0" + } + }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -2913,6 +3104,11 @@ } } }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", @@ -2958,6 +3154,11 @@ } } }, + "is-directory": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz", + "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=" + }, "is-extendable": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", @@ -3072,6 +3273,15 @@ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, + "js-yaml": { + "version": "3.12.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.1.tgz", + "integrity": "sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA==", + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", @@ -3082,6 +3292,11 @@ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" + }, "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", @@ -3580,6 +3795,15 @@ "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", "integrity": "sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=" }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, "parse5": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz", @@ -3939,6 +4163,11 @@ "path-parse": "^1.0.6" } }, + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=" + }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", @@ -4245,6 +4474,11 @@ "through2": "^2.0.2" } }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + }, "sri-toolbox": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/sri-toolbox/-/sri-toolbox-0.2.0.tgz", diff --git a/functions/package.json b/functions/package.json index a7d6727..78a8163 100644 --- a/functions/package.json +++ b/functions/package.json @@ -15,6 +15,7 @@ "@babel/plugin-syntax-export-default-from": "^7.2.0", "@babel/plugin-syntax-export-namespace-from": "^7.2.0", "@babel/plugin-syntax-import-meta": "^7.2.0", + "@emotion/core": "^10.0.6", "cheerio": "^1.0.0-rc.2", "cors": "^2.8.5", "date-fns": "^1.30.1", diff --git a/modules/actions/serveAutoIndexPage.js b/modules/actions/serveAutoIndexPage.js index a664003..c6a867d 100644 --- a/modules/actions/serveAutoIndexPage.js +++ b/modules/actions/serveAutoIndexPage.js @@ -5,9 +5,22 @@ import semver from 'semver'; import MainTemplate from '../client/MainTemplate'; import AutoIndexApp from '../client/autoIndex/App'; import createHTML from '../client/utils/createHTML'; -import getEntryPoints from '../utils/getEntryPoints'; +import getScripts from '../utils/getScripts'; import renderTemplate from '../utils/renderTemplate'; +const globalURLs = + process.env.NODE_ENV === 'production' + ? { + '@emotion/core': '/@emotion/core@10.0.6/dist/core.umd.min.js', + react: '/react@16.7.0/umd/react.production.min.js', + 'react-dom': '/react-dom@16.7.0/umd/react-dom.production.min.js' + } + : { + '@emotion/core': '/@emotion/core@10.0.6/dist/core.umd.min.js', + react: '/react@16.7.0/umd/react.development.js', + 'react-dom': '/react-dom@16.7.0/umd/react-dom.development.js' + }; + function byVersion(a, b) { return semver.lt(a, b) ? -1 : semver.gt(a, b) ? 1 : 0; } @@ -26,17 +39,14 @@ export default function serveAutoIndexPage(req, res) { ReactDOMServer.renderToString(React.createElement(AutoIndexApp, data)) ); - const entryPoints = getEntryPoints('autoIndex', { - es: 'module', - system: 'nomodule' - }); + const scripts = getScripts('autoIndex', globalURLs); const html = renderTemplate(MainTemplate, { title: `UNPKG - ${req.packageName}`, description: `The CDN for ${req.packageName}`, data, content, - entryPoints + scripts }); res diff --git a/modules/actions/serveMainPage.js b/modules/actions/serveMainPage.js index 810a604..83eaf89 100644 --- a/modules/actions/serveMainPage.js +++ b/modules/actions/serveMainPage.js @@ -4,18 +4,26 @@ import { renderToString } from 'react-dom/server'; import MainTemplate from '../client/MainTemplate'; import MainApp from '../client/main/App'; import createHTML from '../client/utils/createHTML'; -import getEntryPoints from '../utils/getEntryPoints'; +import getScripts from '../utils/getScripts'; import renderTemplate from '../utils/renderTemplate'; +const globalURLs = + process.env.NODE_ENV === 'production' + ? { + '@emotion/core': '/@emotion/core@10.0.6/dist/core.umd.min.js', + react: '/react@16.7.0/umd/react.production.min.js', + 'react-dom': '/react-dom@16.7.0/umd/react-dom.production.min.js' + } + : { + '@emotion/core': '/@emotion/core@10.0.6/dist/core.umd.min.js', + react: '/react@16.7.0/umd/react.development.js', + 'react-dom': '/react-dom@16.7.0/umd/react-dom.development.js' + }; + export default function serveMainPage(req, res) { const content = createHTML(renderToString(React.createElement(MainApp))); - - const entryPoints = getEntryPoints('main', { - es: 'module', - system: 'nomodule' - }); - - const html = renderTemplate(MainTemplate, { content, entryPoints }); + const scripts = getScripts('main', globalURLs); + const html = renderTemplate(MainTemplate, { content, scripts }); res .set({ diff --git a/modules/client/.babelrc b/modules/client/.babelrc index d2ac680..4c18fb3 100644 --- a/modules/client/.babelrc +++ b/modules/client/.babelrc @@ -1,8 +1,7 @@ { "presets": [ ["@babel/preset-env", { "loose": true }], - "@babel/preset-react", - "@emotion/babel-preset-css-prop" + "@babel/preset-react" ], "plugins": [ ["@babel/plugin-proposal-class-properties", { "loose": true }] diff --git a/modules/client/MainTemplate.js b/modules/client/MainTemplate.js index 09c3fdc..3697eef 100644 --- a/modules/client/MainTemplate.js +++ b/modules/client/MainTemplate.js @@ -15,7 +15,7 @@ export default function MainTemplate({ favicon, data, content, - entryPoints + scripts }) { return ( @@ -36,22 +36,9 @@ export default function MainTemplate({
- {entryPoints.module && - x(` - import('${entryPoints.module}'); - window.supportsDynamicImport = true; - `)} - {entryPoints.nomodule && - x(` - if (!window.supportsDynamicImport) { - var s = document.createElement('script'); - s.src = '/systemjs@2.0.0/dist/s.min.js'; - s.addEventListener('load', function() { - System.import('${entryPoints.nomodule}'); - }); - document.head.appendChild(s); - } - `)} + {scripts.map(src => ( + - -``` - -where `main.js` is a module available in the System.register module format. - -### Package Name Maps - -Say `main.js` depends on loading `'lodash'`, then we can define a package name map: - -```html - - - - - - -``` - -### Browser transpilation - -To load ES modules directly in older browsers with SystemJS we can install and use the Babel plugin: - -```html - - - - -``` - -## Compatibility with Webpack - -Code-splitting builds on top of native ES modules, like Rollup offers, are an alternative to the Webpack-style chunking approach - offering a way to utilize the native module loader for loading shared and dynamic chunks instead of using a custom registry and loader as Webpack bundles include. Scope-level optimizations can be performed on ES modules when they are combined, while ensuring no duplicate code is loaded through dynamic loading and code-sharing in the module registry, using the features of the native module loader and its dynamic runtime nature. - -There is currently no support for SystemJS in Webpack. If building code using the `System` global in Webpack, the following config is needed to avoid rewriting: - -```js -{ - module: { - rules: [ - { parser: { system: false } } - ] - } -} -``` - -## Polyfills for Older Browsers - -### Promises - -Both builds of SystemJS need Promises in the environment to work, which aren't supported in older browsers like IE11. - -Promises can be conditionally polyfilled using, for example, [Bluebird](http://bluebirdjs.com/docs/getting-started.html) (generally the fastest Promise polyfill): - -```html - -``` - -> Generally `document.write` is not recommended when writing web applications, but for this use case - it works really well and will only apply in older browsers anyway. - -### Fetch - -To support package maps in the system.js build, a fetch polyfill is need. The [GitHub polyfill](https://github.github.io/fetch/) is recommended: - -```html - -``` - -## Loader Extensions - -This list can be extended to include third-party loader extensions. Feel free to [post a PR to share your work](https://github.com/systemjs/systemjs/edit/2.0/README.md). - -* [transform-babel](https://github.com/systemjs/systemjs-transform-babel) Supports ES module transformation into System.register with Babel. -* [json-plugin](https://github.com/Jamaks/systemjs2-json-plugin) JSON loader plugin - -## Contributing to SystemJS - -Project bug fixes and changes are welcome for discussion, provided the project footprint remains minimal. - -To run the tests: - -``` -npm run build && npm run test -``` - -## License - -MIT - -[travis-url]: https://travis-ci.org/systemjs/systemjs -[travis-image]: https://travis-ci.org/systemjs/systemjs.svg?branch=master diff --git a/public/systemjs@2.0.0/dist/extras/amd.js b/public/systemjs@2.0.0/dist/extras/amd.js deleted file mode 100644 index ccc3f8e..0000000 --- a/public/systemjs@2.0.0/dist/extras/amd.js +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Support for AMD loading - */ -(function (global) { - const systemPrototype = System.constructor.prototype; - - const emptyInstantiation = [[], function () { return {} }]; - - function unsupportedRequire () { - throw new Error('AMD require not supported.'); - } - - function unsupportedNamed () { - throw new Error('Named AMD not supported.'); - } - - const requireExportsModule = ['require', 'exports', 'module']; - - // hook System.register to know the last declaration binding - let lastRegisterDeclare; - const systemRegister = systemPrototype.register; - systemPrototype.register = function (deps, declare) { - lastRegisterDeclare = declare; - systemRegister.call(this, deps, declare); - }; - - const getRegister = systemPrototype.getRegister; - systemPrototype.getRegister = function () { - const register = getRegister.call(this); - // if its an actual System.register leave it - if (register && register[1] === lastRegisterDeclare) - return register; - - // otherwise AMD takes priority - // no registration -> attempt AMD detection - if (!amdDefineDeps) - return register || emptyInstantiation; - - const exports = {}; - const module = { exports: exports }; - const depModules = []; - const setters = []; - let splice = 0; - for (let i = 0; i < amdDefineDeps.length; i++) { - const id = amdDefineDeps[i]; - const index = setters.length; - if (id === 'require') { - depModules[i] = unsupportedRequire; - splice++; - } - else if (id === 'module') { - depModules[i] = module; - splice++; - } - else if (id === 'exports') { - depModules[i] = exports; - splice++; - } - else { - // needed for ie11 lack of iteration scope - const idx = i; - setters.push(function (ns) { - depModules[idx] = ns.default; - }); - } - if (splice) - amdDefineDeps[index] = id; - } - if (splice) - amdDefineDeps.length -= splice; - const amdExec = amdDefineExec; - const registration = [amdDefineDeps, function (_export) { - _export('default', exports); - return { - setters: setters, - execute: function () { - _export('default', amdExec.apply(exports, depModules) || module.exports); - } - }; - }]; - amdDefineDeps = null; - return registration; - }; - let amdDefineDeps; - let amdDefineExec; - global.define = function (name, deps, execute) { - // define('', [], function () {}) - if (typeof name === 'string') { - if (amdDefineDeps) { - amdDefineDeps = []; - amdDefineExec = unsupportedNamed; - return; - } - else { - name = deps; - deps = execute; - } - } - // define([], function () {}) - if (name instanceof Array) { - amdDefineDeps = name; - amdDefineExec = deps; - } - // define({}) - else if (typeof name === 'object') { - amdDefineDeps = []; - amdDefineExec = function () { return name }; - } - // define(function () {}) - else if (typeof name === 'function') { - amdDefineDeps = requireExportsModule; - amdDefineExec = name; - } - }; - global.define.amd = {}; -})(typeof self !== 'undefined' ? self : global); \ No newline at end of file diff --git a/public/systemjs@2.0.0/dist/extras/amd.min.js b/public/systemjs@2.0.0/dist/extras/amd.min.js deleted file mode 100644 index 84d0af6..0000000 --- a/public/systemjs@2.0.0/dist/extras/amd.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e){const t=System.constructor.prototype,n=[[],function(){return{}}];function o(){throw new Error("AMD require not supported.")}function r(){throw new Error("Named AMD not supported.")}const i=["require","exports","module"];let u;const f=t.register;t.register=function(e,t){u=t,f.call(this,e,t)};const s=t.getRegister;let c,l;t.getRegister=function(){const e=s.call(this);if(e&&e[1]===u)return e;if(!c)return e||n;const t={},r={exports:t},i=[],f=[];let p=0;for(let e=0;e attempt a global detection as difference from snapshot - // when multiple globals, we take the global value to be the last defined new global object property - // for performance, this will not support multi-version / global collisions as previous SystemJS versions did - // note in Edge, deleting and re-adding a global does not change its ordering - const globalProp = getLastGlobalProp(); - if (lastGlobalProp === globalProp) - return emptyInstantiation; - - lastGlobalProp = globalProp; - let globalExport; - try { - globalExport = global[globalProp]; - } - catch (e) { - return emptyInstantiation; - } - - return [[], function (_export) { - return { execute: function () { _export('default', globalExport) } }; - }]; -}; - -})(typeof self !== 'undefined' ? self : global); \ No newline at end of file diff --git a/public/systemjs@2.0.0/dist/extras/global.min.js b/public/systemjs@2.0.0/dist/extras/global.min.js deleted file mode 100644 index 84b1597..0000000 --- a/public/systemjs@2.0.0/dist/extras/global.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(t){const n=System.constructor.prototype;function e(){let n;for(let e in t)t.hasOwnProperty(e)&&(n=e);return n}let r;const o=n.import;n.import=function(t,n){return r=e(),o.call(this,t,n)};const c=[[],function(){return{}}],u=n.getRegister;n.getRegister=function(){const n=u.call(this);if(n)return n;const o=e();if(r===o)return c;let i;r=o;try{i=t[o]}catch(t){return c}return[[],function(t){return{execute:function(){t("default",i)}}}]}}("undefined"!=typeof self?self:global); \ No newline at end of file diff --git a/public/systemjs@2.0.0/dist/extras/global.min.js.map b/public/systemjs@2.0.0/dist/extras/global.min.js.map deleted file mode 100644 index 276e8d1..0000000 --- a/public/systemjs@2.0.0/dist/extras/global.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["global.js"],"names":["global","systemJSPrototype","System","constructor","prototype","getLastGlobalProp","lastProp","p","hasOwnProperty","lastGlobalProp","impt","import","id","parentUrl","call","this","emptyInstantiation","getRegister","lastRegister","globalProp","globalExport","e","_export","execute","self"],"mappings":"CAKA,SAAWA,GAEX,MAAMC,EAAoBC,OAAOC,YAAYC,UAE7C,SAASC,IAGP,IAAIC,EACJ,IAAK,IAAIC,KAAKP,EACRA,EAAOQ,eAAeD,KACxBD,EAAWC,GACf,OAAOD,EAGT,IAAIG,EACJ,MAAMC,EAAOT,EAAkBU,OAC/BV,EAAkBU,OAAS,SAAUC,EAAIC,GAEvC,OADAJ,EAAiBJ,IACVK,EAAKI,KAAKC,KAAMH,EAAIC,IAG7B,MAAMG,EAAqB,CAAC,GAAI,WAAc,MAAO,KAE/CC,EAAchB,EAAkBgB,YACtChB,EAAkBgB,YAAc,WAC9B,MAAMC,EAAeD,EAAYH,KAAKC,MACtC,GAAIG,EACF,OAAOA,EAMT,MAAMC,EAAad,IACnB,GAAII,IAAmBU,EACrB,OAAOH,EAGT,IAAII,EADJX,EAAiBU,EAEjB,IACEC,EAAepB,EAAOmB,GAExB,MAAOE,GACL,OAAOL,EAGT,MAAO,CAAC,GAAI,SAAUM,GACpB,MAAO,CAAEC,QAAS,WAAcD,EAAQ,UAAWF,QA/CvD,CAmDmB,oBAATI,KAAuBA,KAAOxB"} \ No newline at end of file diff --git a/public/systemjs@2.0.0/dist/extras/named-exports.js b/public/systemjs@2.0.0/dist/extras/named-exports.js deleted file mode 100644 index 87935cd..0000000 --- a/public/systemjs@2.0.0/dist/extras/named-exports.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Named exports support for legacy module formats in SystemJS 2.0 - */ -(function () { - const systemPrototype = System.constructor.prototype; - - // hook System.register to know the last declaration binding - let lastRegisterDeclare; - const systemRegister = systemPrototype.register; - systemPrototype.register = function (deps, declare) { - lastRegisterDeclare = declare; - systemRegister.call(this, deps, declare); - }; - - const getRegister = systemPrototype.getRegister; - systemPrototype.getRegister = function () { - const register = getRegister.call(this); - // if it is an actual System.register call, then its ESM - // -> dont add named exports - if (!register || register[1] === lastRegisterDeclare || register[1].length === 0) - return register; - - // otherwise it was provided by a custom instantiator - // -> extend the registration with named exports support - const registerDeclare = register[1]; - register[1] = function (_export, _context) { - // hook the _export function to note the default export - let defaultExport; - const declaration = registerDeclare.call(this, function (name, value) { - if (name === 'default') - defaultExport = value; - _export(name, value); - }, _context); - // hook the execute function - const execute = declaration.execute; - if (execute) - declaration.execute = function () { - execute.call(this); - // do a bulk export of the default export object - // to export all its names as named exports - if (typeof defaultExport === 'object') - _export(defaultExport); - }; - return declaration; - }; - return register; - }; -})(); \ No newline at end of file diff --git a/public/systemjs@2.0.0/dist/extras/named-exports.min.js b/public/systemjs@2.0.0/dist/extras/named-exports.min.js deleted file mode 100644 index 20596d0..0000000 --- a/public/systemjs@2.0.0/dist/extras/named-exports.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(){const t=System.constructor.prototype;let e;const n=t.register;t.register=function(t,c){e=c,n.call(this,t,c)};const c=t.getRegister;t.getRegister=function(){const t=c.call(this);if(!t||t[1]===e||0===t[1].length)return t;const n=t[1];return t[1]=function(t,e){let c;const o=n.call(this,function(e,n){"default"===e&&(c=n),t(e,n)},e),s=o.execute;return s&&(o.execute=function(){s.call(this),"object"==typeof c&&t(c)}),o},t}}(); \ No newline at end of file diff --git a/public/systemjs@2.0.0/dist/extras/named-exports.min.js.map b/public/systemjs@2.0.0/dist/extras/named-exports.min.js.map deleted file mode 100644 index 48948ff..0000000 --- a/public/systemjs@2.0.0/dist/extras/named-exports.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["named-exports.js"],"names":["systemPrototype","System","constructor","prototype","lastRegisterDeclare","systemRegister","register","deps","declare","call","this","getRegister","length","registerDeclare","_export","_context","defaultExport","declaration","name","value","execute"],"mappings":"CAGA,WACE,MAAMA,EAAkBC,OAAOC,YAAYC,UAG3C,IAAIC,EACJ,MAAMC,EAAiBL,EAAgBM,SACvCN,EAAgBM,SAAW,SAAUC,EAAMC,GACzCJ,EAAsBI,EACtBH,EAAeI,KAAKC,KAAMH,EAAMC,IAGlC,MAAMG,EAAcX,EAAgBW,YACpCX,EAAgBW,YAAc,WAC5B,MAAML,EAAWK,EAAYF,KAAKC,MAGlC,IAAKJ,GAAYA,EAAS,KAAOF,GAA8C,IAAvBE,EAAS,GAAGM,OAClE,OAAON,EAIT,MAAMO,EAAkBP,EAAS,GAqBjC,OApBAA,EAAS,GAAK,SAAUQ,EAASC,GAE/B,IAAIC,EACJ,MAAMC,EAAcJ,EAAgBJ,KAAKC,KAAM,SAAUQ,EAAMC,GAChD,YAATD,IACFF,EAAgBG,GAClBL,EAAQI,EAAMC,IACbJ,GAEGK,EAAUH,EAAYG,QAS5B,OARIA,IACFH,EAAYG,QAAU,WACpBA,EAAQX,KAAKC,MAGgB,iBAAlBM,GACTF,EAAQE,KAEPC,GAEFX,GA1CX"} \ No newline at end of file diff --git a/public/systemjs@2.0.0/dist/extras/transform.js b/public/systemjs@2.0.0/dist/extras/transform.js deleted file mode 100644 index 1d4722c..0000000 --- a/public/systemjs@2.0.0/dist/extras/transform.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Support for a "transform" loader interface - */ -(function () { - const systemJSPrototype = System.constructor.prototype; - - const instantiate = systemJSPrototype.instantiate; - systemJSPrototype.instantiate = function (url, parent) { - if (url.slice(-5) === '.wasm') - return instantiate.call(this, url, parent); - - const loader = this; - return fetch(url) - .then(function (res) { - if (!res.ok) - throw new Error('Fetch error: ' + res.status + ' ' + res.statusText + (parent ? ' loading from ' + parent : '')); - return res.text(); - }) - .then(function (source) { - return loader.transform.call(this, url, source); - }) - .then(function (source) { - (0, eval)(source + '\n//# sourceURL=' + url); - return loader.getRegister(); - }); - }; - - // Hookable transform function! - systemJSPrototype.transform = function (_id, source) { - return source; - }; -})(); \ No newline at end of file diff --git a/public/systemjs@2.0.0/dist/extras/transform.min.js b/public/systemjs@2.0.0/dist/extras/transform.min.js deleted file mode 100644 index 17531ff..0000000 --- a/public/systemjs@2.0.0/dist/extras/transform.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(){const t=System.constructor.prototype,n=t.instantiate;t.instantiate=function(t,r){if(".wasm"===t.slice(-5))return n.call(this,t,r);const e=this;return fetch(t).then(function(t){if(!t.ok)throw new Error("Fetch error: "+t.status+" "+t.statusText+(r?" loading from "+r:""));return t.text()}).then(function(n){return e.transform.call(this,t,n)}).then(function(n){return(0,eval)(n+"\n//# sourceURL="+t),e.getRegister()})},t.transform=function(t,n){return n}}(); \ No newline at end of file diff --git a/public/systemjs@2.0.0/dist/extras/transform.min.js.map b/public/systemjs@2.0.0/dist/extras/transform.min.js.map deleted file mode 100644 index 78d2a26..0000000 --- a/public/systemjs@2.0.0/dist/extras/transform.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["transform.js"],"names":["systemJSPrototype","System","constructor","prototype","instantiate","url","parent","slice","call","this","loader","fetch","then","res","ok","Error","status","statusText","text","source","transform","eval","getRegister","_id"],"mappings":"CAGA,WACE,MAAMA,EAAoBC,OAAOC,YAAYC,UAEvCC,EAAcJ,EAAkBI,YACtCJ,EAAkBI,YAAc,SAAUC,EAAKC,GAC7C,GAAsB,UAAlBD,EAAIE,OAAO,GACb,OAAOH,EAAYI,KAAKC,KAAMJ,EAAKC,GAErC,MAAMI,EAASD,KACf,OAAOE,MAAMN,GACZO,KAAK,SAAUC,GACd,IAAKA,EAAIC,GACP,MAAM,IAAIC,MAAM,gBAAkBF,EAAIG,OAAS,IAAMH,EAAII,YAAcX,EAAS,kBAAoBA,EAAS,KAC/G,OAAOO,EAAIK,SAEZN,KAAK,SAAUO,GACd,OAAOT,EAAOU,UAAUZ,KAAKC,KAAMJ,EAAKc,KAEzCP,KAAK,SAAUO,GAEd,OADA,EAAIE,MAAMF,EAAS,mBAAqBd,GACjCK,EAAOY,iBAKlBtB,EAAkBoB,UAAY,SAAUG,EAAKJ,GAC3C,OAAOA,GA1BX"} \ No newline at end of file diff --git a/public/systemjs@2.0.0/dist/s.js b/public/systemjs@2.0.0/dist/s.js deleted file mode 100644 index aa64f6c..0000000 --- a/public/systemjs@2.0.0/dist/s.js +++ /dev/null @@ -1,403 +0,0 @@ -/* -* SJS 2.0.0 -* Minimal SystemJS Build -*/ -(function () { - const hasSelf = typeof self !== 'undefined'; - - const envGlobal = hasSelf ? self : global; - - let baseUrl; - if (typeof location !== 'undefined') { - baseUrl = location.href.split('#')[0].split('?')[0]; - const lastSepIndex = baseUrl.lastIndexOf('/'); - if (lastSepIndex !== -1) - baseUrl = baseUrl.slice(0, lastSepIndex + 1); - } - - const backslashRegEx = /\\/g; - function resolveIfNotPlainOrUrl (relUrl, parentUrl) { - if (relUrl.indexOf('\\') !== -1) - relUrl = relUrl.replace(backslashRegEx, '/'); - // protocol-relative - if (relUrl[0] === '/' && relUrl[1] === '/') { - return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl; - } - // relative-url - else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) || - relUrl.length === 1 && (relUrl += '/')) || - relUrl[0] === '/') { - const parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1); - // Disabled, but these cases will give inconsistent results for deep backtracking - //if (parentUrl[parentProtocol.length] !== '/') - // throw new Error('Cannot resolve'); - // read pathname from parent URL - // pathname taken to be part after leading "/" - let pathname; - if (parentUrl[parentProtocol.length + 1] === '/') { - // resolving to a :// so we need to read out the auth and host - if (parentProtocol !== 'file:') { - pathname = parentUrl.slice(parentProtocol.length + 2); - pathname = pathname.slice(pathname.indexOf('/') + 1); - } - else { - pathname = parentUrl.slice(8); - } - } - else { - // resolving to :/ so pathname is the /... part - pathname = parentUrl.slice(parentProtocol.length + 1); - } - - if (relUrl[0] === '/') - return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl; - - // join together and split for removal of .. and . segments - // looping the string instead of anything fancy for perf reasons - // '../../../../../z' resolved to 'x/y' is just 'z' - const segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl; - - const output = []; - let segmentIndex = -1; - for (let i = 0; i < segmented.length; i++) { - // busy reading a segment - only terminate on '/' - if (segmentIndex !== -1) { - if (segmented[i] === '/') { - output.push(segmented.slice(segmentIndex, i + 1)); - segmentIndex = -1; - } - } - - // new segment - check if it is relative - else if (segmented[i] === '.') { - // ../ segment - if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) { - output.pop(); - i += 2; - } - // ./ segment - else if (segmented[i + 1] === '/' || i + 1 === segmented.length) { - i += 1; - } - else { - // the start of a new segment as below - segmentIndex = i; - } - } - // it is the start of a new segment - else { - segmentIndex = i; - } - } - // finish reading out the last segment - if (segmentIndex !== -1) - output.push(segmented.slice(segmentIndex)); - return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join(''); - } - } - - /* - * SystemJS Core - * - * Provides - * - System.import - * - System.register support for - * live bindings, function hoisting through circular references, - * reexports, dynamic import, import.meta.url, top-level await - * - System.getRegister to get the registration - * - Symbol.toStringTag support in Module objects - * - Hookable System.createContext to customize import.meta - * - System.onload(id, err?) handler for tracing / hot-reloading - * - * Core comes with no System.prototype.resolve or - * System.prototype.instantiate implementations - */ - - const hasSymbol = typeof Symbol !== 'undefined'; - const toStringTag = hasSymbol && Symbol.toStringTag; - const REGISTRY = hasSymbol ? Symbol() : '@'; - - function SystemJS () { - this[REGISTRY] = {}; - } - - const systemJSPrototype = SystemJS.prototype; - systemJSPrototype.import = function (id, parentUrl) { - const loader = this; - return Promise.resolve(loader.resolve(id, parentUrl)) - .then(function (id) { - const load = getOrCreateLoad(loader, id); - return load.C || topLevelLoad(loader, load); - }); - }; - - // Hookable createContext function -> allowing eg custom import meta - systemJSPrototype.createContext = function (parentId) { - return { - url: parentId - }; - }; - - let lastRegister; - systemJSPrototype.register = function (deps, declare) { - lastRegister = [deps, declare]; - }; - - /* - * getRegister provides the last anonymous System.register call - */ - systemJSPrototype.getRegister = function () { - const _lastRegister = lastRegister; - lastRegister = undefined; - return _lastRegister; - }; - - function getOrCreateLoad (loader, id, firstParentUrl) { - let load = loader[REGISTRY][id]; - if (load) - return load; - - const importerSetters = []; - const ns = Object.create(null); - if (toStringTag) - Object.defineProperty(ns, toStringTag, { value: 'Module' }); - - let instantiatePromise = Promise.resolve() - .then(function () { - return loader.instantiate(id, firstParentUrl); - }) - .then(function (registration) { - if (!registration) - throw new Error('Module ' + id + ' did not instantiate'); - function _export (name, value) { - // note if we have hoisted exports (including reexports) - load.h = true; - let changed = false; - if (typeof name !== 'object') { - if (!(name in ns) || ns[name] !== value) { - ns[name] = value; - changed = true; - } - } - else { - for (let p in name) { - let value = name[p]; - if (!(p in ns) || ns[p] !== value) { - ns[p] = value; - changed = true; - } - } - } - if (changed) - for (let i = 0; i < importerSetters.length; i++) - importerSetters[i](ns); - return value; - } - const declared = registration[1](_export, registration[1].length === 2 ? { - import: function (importId) { - return loader.import(importId, id); - }, - meta: loader.createContext(id) - } : undefined); - load.e = declared.execute || function () {}; - return [registration[0], declared.setters || []]; - }); - - const linkPromise = instantiatePromise - .then(function (instantiation) { - return Promise.all(instantiation[0].map(function (dep, i) { - const setter = instantiation[1][i]; - return Promise.resolve(loader.resolve(dep, id)) - .then(function (depId) { - const depLoad = getOrCreateLoad(loader, depId, id); - // depLoad.I may be undefined for already-evaluated - return Promise.resolve(depLoad.I) - .then(function () { - if (setter) { - depLoad.i.push(setter); - // only run early setters when there are hoisted exports of that module - // the timing works here as pending hoisted export calls will trigger through importerSetters - if (depLoad.h || !depLoad.I) - setter(depLoad.n); - } - return depLoad; - }); - }) - })) - .then(function (depLoads) { - load.d = depLoads; - }); - }); - - // disable unhandled rejections - linkPromise.catch(function () {}); - - // Captial letter = a promise function - return load = loader[REGISTRY][id] = { - id: id, - // importerSetters, the setters functions registered to this dependency - // we retain this to add more later - i: importerSetters, - // module namespace object - n: ns, - - // instantiate - I: instantiatePromise, - // link - L: linkPromise, - // whether it has hoisted exports - h: false, - - // On instantiate completion we have populated: - // dependency load records - d: undefined, - // execution function - // set to NULL immediately after execution (or on any failure) to indicate execution has happened - // in such a case, pC should be used, and pLo, pLi will be emptied - e: undefined, - - // On execution we have populated: - // the execution error if any - eE: undefined, - // in the case of TLA, the execution promise - E: undefined, - - // On execution, pLi, pLo, e cleared - - // Promise for top-level completion - C: undefined - }; - } - - function instantiateAll (loader, load, loaded) { - if (!loaded[load.id]) { - loaded[load.id] = true; - // load.L may be undefined for already-instantiated - return Promise.resolve(load.L) - .then(function () { - return Promise.all(load.d.map(function (dep) { - return instantiateAll(loader, dep, loaded); - })); - }) - } - } - - function topLevelLoad (loader, load) { - return load.C = instantiateAll(loader, load, {}) - .then(function () { - return postOrderExec(loader, load, {}); - }) - .then(function () { - return load.n; - }); - } - - // the closest we can get to call(undefined) - const nullContext = Object.freeze(Object.create(null)); - - // returns a promise if and only if a top-level await subgraph - // throws on sync errors - function postOrderExec (loader, load, seen) { - if (seen[load.id]) - return; - seen[load.id] = true; - - if (!load.e) { - if (load.eE) - throw load.eE; - if (load.E) - return load.E; - return; - } - - // deps execute first, unless circular - let depLoadPromises; - load.d.forEach(function (depLoad) { - { - const depLoadPromise = postOrderExec(loader, depLoad, seen); - if (depLoadPromise) - (depLoadPromises = depLoadPromises || []).push(depLoadPromise); - } - }); - if (depLoadPromises) { - return load.E = Promise.all(depLoadPromises).then(doExec); - } - - return doExec(); - - function doExec () { - try { - let execPromise = load.e.call(nullContext); - if (execPromise) { - execPromise.then(function () { - load.C = load.n; - load.E = null; - }); - execPromise.catch(function () {}); - return load.E = load.E || execPromise; - } - // (should be a promise, but a minify optimization to leave out Promise.resolve) - load.C = load.n; - } - catch (err) { - load.eE = err; - throw err; - } - finally { - load.L = load.I = undefined; - load.e = null; - } - } - } - - envGlobal.System = new SystemJS(); - - /* - * Supports loading System.register via script tag injection - */ - - let err$1; - if (typeof window !== 'undefined') - window.addEventListener('error', function (e) { - err$1 = e.error; - }); - - const systemRegister = systemJSPrototype.register; - systemJSPrototype.register = function (deps, declare) { - err$1 = undefined; - systemRegister.call(this, deps, declare); - }; - - systemJSPrototype.instantiate = function (url, firstParentUrl) { - const loader = this; - return new Promise(function (resolve, reject) { - const script = document.createElement('script'); - script.charset = 'utf-8'; - script.async = true; - script.addEventListener('error', function () { - reject(new Error('Error loading ' + url + (firstParentUrl ? ' from ' + firstParentUrl : ''))); - }); - script.addEventListener('load', function () { - document.head.removeChild(script); - // Note URL normalization issues are going to be a careful concern here - if (err$1) - return reject(err$1); - else - resolve(loader.getRegister()); - }); - script.src = url; - document.head.appendChild(script); - }); - }; - - systemJSPrototype.resolve = function (id, parentUrl) { - const resolved = resolveIfNotPlainOrUrl(id, parentUrl || baseUrl); - if (!resolved) { - if (id.indexOf(':') !== -1) - return id; - throw new Error('Cannot resolve "' + id + (parentUrl ? '" from ' + parentUrl : '"')); - } - return resolved; - }; - -}()); diff --git a/public/systemjs@2.0.0/dist/s.min.js b/public/systemjs@2.0.0/dist/s.min.js deleted file mode 100644 index bbe1340..0000000 --- a/public/systemjs@2.0.0/dist/s.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(){const e="undefined"!=typeof self?self:global;let n;if("undefined"!=typeof location){const e=(n=location.href.split("#")[0].split("?")[0]).lastIndexOf("/");-1!==e&&(n=n.slice(0,e+1))}const t=/\\/g,r="undefined"!=typeof Symbol,i=r&&Symbol.toStringTag,o=r?Symbol():"@";function c(){this[o]={}}const l=c.prototype;let u;l.import=function(e,n){const t=this;return Promise.resolve(t.resolve(e,n)).then(function(e){const n=function e(n,t,r){let c=n[o][t];if(c)return c;const l=[],u=Object.create(null);i&&Object.defineProperty(u,i,{value:"Module"});let f=Promise.resolve().then(function(){return n.instantiate(t,r)}).then(function(e){if(!e)throw new Error("Module "+t+" did not instantiate");const r=e[1](function(e,n){c.h=!0;let t=!1;if("object"!=typeof e)e in u&&u[e]===n||(u[e]=n,t=!0);else for(let n in e){let r=e[n];n in u&&u[n]===r||(u[n]=r,t=!0)}if(t)for(let e=0;e allowing eg custom import meta - systemJSPrototype.createContext = function (parentId) { - return { - url: parentId - }; - }; - - // onLoad(id, err) provided for tracing / hot-reloading - systemJSPrototype.onload = function () {}; - - let lastRegister; - systemJSPrototype.register = function (deps, declare) { - lastRegister = [deps, declare]; - }; - - /* - * getRegister provides the last anonymous System.register call - */ - systemJSPrototype.getRegister = function () { - const _lastRegister = lastRegister; - lastRegister = undefined; - return _lastRegister; - }; - - function getOrCreateLoad (loader, id, firstParentUrl) { - let load = loader[REGISTRY][id]; - if (load) - return load; - - const importerSetters = []; - const ns = Object.create(null); - if (toStringTag) - Object.defineProperty(ns, toStringTag, { value: 'Module' }); - - let instantiatePromise = Promise.resolve() - .then(function () { - return loader.instantiate(id, firstParentUrl); - }) - .then(function (registration) { - if (!registration) - throw new Error('Module ' + id + ' did not instantiate'); - function _export (name, value) { - // note if we have hoisted exports (including reexports) - load.h = true; - let changed = false; - if (typeof name !== 'object') { - if (!(name in ns) || ns[name] !== value) { - ns[name] = value; - changed = true; - } - } - else { - for (let p in name) { - let value = name[p]; - if (!(p in ns) || ns[p] !== value) { - ns[p] = value; - changed = true; - } - } - } - if (changed) - for (let i = 0; i < importerSetters.length; i++) - importerSetters[i](ns); - return value; - } - const declared = registration[1](_export, registration[1].length === 2 ? { - import: function (importId) { - return loader.import(importId, id); - }, - meta: loader.createContext(id) - } : undefined); - load.e = declared.execute || function () {}; - return [registration[0], declared.setters || []]; - }); - - instantiatePromise = instantiatePromise.catch(function (err) { - loader.onload(load.id, err); - throw err; - }); - - const linkPromise = instantiatePromise - .then(function (instantiation) { - return Promise.all(instantiation[0].map(function (dep, i) { - const setter = instantiation[1][i]; - return Promise.resolve(loader.resolve(dep, id)) - .then(function (depId) { - const depLoad = getOrCreateLoad(loader, depId, id); - // depLoad.I may be undefined for already-evaluated - return Promise.resolve(depLoad.I) - .then(function () { - if (setter) { - depLoad.i.push(setter); - // only run early setters when there are hoisted exports of that module - // the timing works here as pending hoisted export calls will trigger through importerSetters - if (depLoad.h || !depLoad.I) - setter(depLoad.n); - } - return depLoad; - }); - }) - })) - .then(function (depLoads) { - load.d = depLoads; - }); - }); - - // disable unhandled rejections - linkPromise.catch(function () {}); - - // Captial letter = a promise function - return load = loader[REGISTRY][id] = { - id: id, - // importerSetters, the setters functions registered to this dependency - // we retain this to add more later - i: importerSetters, - // module namespace object - n: ns, - - // instantiate - I: instantiatePromise, - // link - L: linkPromise, - // whether it has hoisted exports - h: false, - - // On instantiate completion we have populated: - // dependency load records - d: undefined, - // execution function - // set to NULL immediately after execution (or on any failure) to indicate execution has happened - // in such a case, pC should be used, and pLo, pLi will be emptied - e: undefined, - - // On execution we have populated: - // the execution error if any - eE: undefined, - // in the case of TLA, the execution promise - E: undefined, - - // On execution, pLi, pLo, e cleared - - // Promise for top-level completion - C: undefined - }; - } - - function instantiateAll (loader, load, loaded) { - if (!loaded[load.id]) { - loaded[load.id] = true; - // load.L may be undefined for already-instantiated - return Promise.resolve(load.L) - .then(function () { - return Promise.all(load.d.map(function (dep) { - return instantiateAll(loader, dep, loaded); - })); - }) - } - } - - function topLevelLoad (loader, load) { - return load.C = instantiateAll(loader, load, {}) - .then(function () { - return postOrderExec(loader, load, {}); - }) - .then(function () { - return load.n; - }); - } - - // the closest we can get to call(undefined) - const nullContext = Object.freeze(Object.create(null)); - - // returns a promise if and only if a top-level await subgraph - // throws on sync errors - function postOrderExec (loader, load, seen) { - if (seen[load.id]) - return; - seen[load.id] = true; - - if (!load.e) { - if (load.eE) - throw load.eE; - if (load.E) - return load.E; - return; - } - - // deps execute first, unless circular - let depLoadPromises; - load.d.forEach(function (depLoad) { - { - try { - const depLoadPromise = postOrderExec(loader, depLoad, seen); - if (depLoadPromise) - (depLoadPromises = depLoadPromises || []).push(depLoadPromise); - } - catch (err) { - loader.onload(load.id, err); - throw err; - } - } - }); - if (depLoadPromises) { - return Promise.all(depLoadPromises) - .then(doExec) - .catch(function (err) { - loader.onload(load.id, err); - throw err; - }); - } - - return doExec(); - - function doExec () { - try { - let execPromise = load.e.call(nullContext); - if (execPromise) { - execPromise = execPromise.then(function () { - load.C = load.n; - load.E = null; // indicates completion - loader.onload(load.id, null); - }, function () { - loader.onload(load.id, err); - throw err; - }); - execPromise.catch(function () {}); - return load.E = load.E || execPromise; - } - // (should be a promise, but a minify optimization to leave out Promise.resolve) - load.C = load.n; - loader.onload(load.id, null); - } - catch (err) { - loader.onload(load.id, err); - load.eE = err; - throw err; - } - finally { - load.L = load.I = undefined; - load.e = null; - } - } - } - - envGlobal.System = new SystemJS(); - - /* - * Supports loading System.register via script tag injection - */ - - let err$1; - if (typeof window !== 'undefined') - window.addEventListener('error', function (e) { - err$1 = e.error; - }); - - const systemRegister = systemJSPrototype.register; - systemJSPrototype.register = function (deps, declare) { - err$1 = undefined; - systemRegister.call(this, deps, declare); - }; - - systemJSPrototype.instantiate = function (url, firstParentUrl) { - const loader = this; - return new Promise(function (resolve, reject) { - const script = document.createElement('script'); - script.charset = 'utf-8'; - script.async = true; - script.addEventListener('error', function () { - reject(new Error('Error loading ' + url + (firstParentUrl ? ' from ' + firstParentUrl : ''))); - }); - script.addEventListener('load', function () { - document.head.removeChild(script); - // Note URL normalization issues are going to be a careful concern here - if (err$1) - return reject(err$1); - else - resolve(loader.getRegister()); - }); - script.src = url; - document.head.appendChild(script); - }); - }; - - /* - * Supports loading System.register in workers - */ - - if (hasSelf && typeof importScripts === 'function') - systemJSPrototype.instantiate = function (url) { - const loader = this; - return new Promise(function (resolve, reject) { - try { - importScripts(url); - } - catch (e) { - reject(e); - } - resolve(loader.getRegister()); - }); - }; - - /* - * SystemJS global script loading support - * Extra for the s.js build only - * (Included by default in system.js build) - */ - (function (global) { - - const systemJSPrototype = System.constructor.prototype; - - function getLastGlobalProp () { - // alternatively Object.keys(global).pop() - // but this may be faster (pending benchmarks) - let lastProp; - for (let p in global) - if (global.hasOwnProperty(p)) - lastProp = p; - return lastProp; - } - - let lastGlobalProp; - const impt = systemJSPrototype.import; - systemJSPrototype.import = function (id, parentUrl) { - lastGlobalProp = getLastGlobalProp(); - return impt.call(this, id, parentUrl); - }; - - const emptyInstantiation = [[], function () { return {} }]; - - const getRegister = systemJSPrototype.getRegister; - systemJSPrototype.getRegister = function () { - const lastRegister = getRegister.call(this); - if (lastRegister) - return lastRegister; - - // no registration -> attempt a global detection as difference from snapshot - // when multiple globals, we take the global value to be the last defined new global object property - // for performance, this will not support multi-version / global collisions as previous SystemJS versions did - // note in Edge, deleting and re-adding a global does not change its ordering - const globalProp = getLastGlobalProp(); - if (lastGlobalProp === globalProp) - return emptyInstantiation; - - lastGlobalProp = globalProp; - let globalExport; - try { - globalExport = global[globalProp]; - } - catch (e) { - return emptyInstantiation; - } - - return [[], function (_export) { - return { execute: function () { _export('default', globalExport); } }; - }]; - }; - - })(typeof self !== 'undefined' ? self : global); - - /* - * Loads WASM based on file extension detection - * Assumes successive instantiate will handle other files - */ - const instantiate = systemJSPrototype.instantiate; - systemJSPrototype.instantiate = function (url, parent) { - if (url.slice(-5) !== '.wasm') - return instantiate.call(this, url, parent); - - return fetch(url) - .then(function (res) { - if (!res.ok) - throw new Error(res.status + ' ' + res.statusText + ' ' + res.url + (parent ? ' loading from ' + parent : '')); - return WebAssembly.compileStreaming(res); - }) - .then(function (module) { - const deps = []; - const setters = []; - const importObj = {}; - - // we can only set imports if supported (eg early Safari doesnt support) - if (WebAssembly.Module.imports) - WebAssembly.Module.imports(module).forEach(function (impt) { - const key = impt.module; - setters.push(function (m) { - importObj[key] = m; - }); - if (deps.indexOf(key) === -1) - deps.push(key); - }); - - return [deps, function (_export) { - return { - setters: setters, - execute: function () { - _export(new WebAssembly.Instance(module, importObj).exports); - } - }; - }]; - }); - }; - - /* - * Package name map support for SystemJS - * - * - * OR - * - * - * Only supports loading the first package map - */ - - let packageMapPromise, packageMapResolve; - if (typeof document !== 'undefined') { - const scripts = document.getElementsByTagName('script'); - for (let i = 0; i < scripts.length; i++) { - const script = scripts[i]; - if (script.type !== 'systemjs-packagemap') - continue; - - if (!script.src) { - packageMapResolve = createPackageMap(JSON.parse(script.innerHTML), baseUrl); - packageMapPromise = Promise.resolve(); - } - else { - packageMapPromise = fetch(script.src) - .then(function (res) { - return res.json(); - }) - .then(function (json) { - packageMapResolve = createPackageMap(json, script.src); - packageMapPromise = undefined; - }, function () { - packageMapResolve = throwBare; - packageMapPromise = undefined; - }); - } - break; - } - } - if (!packageMapPromise) - packageMapResolve = throwBare; - - systemJSPrototype.resolve = function (id, parentUrl) { - parentUrl = parentUrl || baseUrl; - - const resolvedIfNotPlainOrUrl = resolveIfNotPlainOrUrl(id, parentUrl); - if (resolvedIfNotPlainOrUrl) - return resolvedIfNotPlainOrUrl; - if (id.indexOf(':') !== -1) - return id; - - // now just left with plain - // (if not package map, packageMapResolve just throws) - if (packageMapPromise) - return packageMapPromise - .then(function () { - return packageMapResolve(id, parentUrl); - }); - - return packageMapResolve(id, parentUrl); - }; - - systemJSPrototype.get = function (id) { - const load = this[REGISTRY][id]; - if (load && load.e === null && !load.E) { - if (load.eE) - return null; - return load.n; - } - }; - - // Delete function provided for hot-reloading use cases - systemJSPrototype.delete = function (id) { - const load = this.get(id); - if (load === undefined) - return false; - // remove from importerSetters - // (release for gc) - if (load && load.d) - load.d.forEach(function (depLoad) { - const importerIndex = depLoad.i.indexOf(load); - if (importerIndex !== -1) - depLoad.i.splice(importerIndex, 1); - }); - return delete this[REGISTRY][id]; - }; - -}()); diff --git a/public/systemjs@2.0.0/dist/system.min.js b/public/systemjs@2.0.0/dist/system.min.js deleted file mode 100644 index 1d119de..0000000 --- a/public/systemjs@2.0.0/dist/system.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/* -* SystemJS 2.0.0 -*/ -!function(){const t="undefined"!=typeof self,n=t?self:global;let e;if("undefined"!=typeof location){const t=(e=location.href.split("#")[0].split("?")[0]).lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}const o=/\\/g;function r(t,n){if(-1!==t.indexOf("\\")&&(t=t.replace(o,"/")),"/"===t[0]&&"/"===t[1])return n.slice(0,n.indexOf(":")+1)+t;if("."===t[0]&&("/"===t[1]||"."===t[1]&&("/"===t[2]||2===t.length&&(t+="/"))||1===t.length&&(t+="/"))||"/"===t[0]){const e=n.slice(0,n.indexOf(":")+1);let o;if(o="/"===n[e.length+1]?"file:"!==e?(o=n.slice(e.length+2)).slice(o.indexOf("/")+1):n.slice(8):n.slice(e.length+1),"/"===t[0])return n.slice(0,n.length-o.length-1)+t;const r=o.slice(0,o.lastIndexOf("/")+1)+t,i=[];let c=-1;for(let t=0;t { + return { + external: ['react', 'react-dom', '@emotion/core'], + input: `modules/client/${entryName}.js`, + output: { + format: 'iife', dir: 'public/_client', entryFileNames: '[name]-[hash].js', - chunkFileNames: '[name]-[hash].js' - }, - { - // SystemJS version for older browsers - format: 'system', - dir: 'public/_client', - entryFileNames: '[name]-[hash].system.js', - chunkFileNames: '[name]-[hash].system.js' - } - ], - plugins: [ - manifest.record({ publicPath: '/_client/' }), - babel({ exclude: /node_modules/ }), - json(), - resolve(), - commonjs({ - namedExports: { - 'node_modules/react/index.js': [ - 'createContext', - 'createElement', - 'forwardRef', - 'Component', - 'Fragment' - ] + globals: { + react: 'React', + 'react-dom': 'ReactDOM', + '@emotion/core': 'emotionCore' } - }), - replace({ - 'process.env.NODE_ENV': JSON.stringify(env) - }), - url({ - limit: 5 * 1024, - publicPath: '/_client/' - }) - ] -}; + }, + plugins: [ + manifest.record({ publicPath: '/_client/' }), + babel({ exclude: /node_modules/ }), + json(), + resolve(), + commonjs({ + namedExports: { + 'node_modules/react/index.js': [ + 'createContext', + 'createElement', + 'forwardRef', + 'Component', + 'Fragment' + ] + } + }), + replace({ + 'process.env.NODE_ENV': JSON.stringify(env) + }), + url({ + limit: 5 * 1024, + publicPath: '/_client/' + }) + ] + }; +}); + +// const client = { +// input: ['modules/client/main.js', 'modules/client/autoIndex.js'], +// output: [ +// { +// // ESM version for modern browsers +// format: 'esm', +// dir: 'public/_client', +// entryFileNames: '[name]-[hash].js', +// chunkFileNames: '[name]-[hash].js' +// }, +// { +// // SystemJS version for older browsers +// format: 'system', +// dir: 'public/_client', +// entryFileNames: '[name]-[hash].system.js', +// chunkFileNames: '[name]-[hash].system.js' +// } +// ], +// plugins: [ +// manifest.record({ publicPath: '/_client/' }), +// babel({ exclude: /node_modules/ }), +// json(), +// resolve(), +// commonjs({ +// namedExports: { +// 'node_modules/react/index.js': [ +// 'createContext', +// 'createElement', +// 'forwardRef', +// 'Component', +// 'Fragment' +// ] +// } +// }), +// replace({ +// 'process.env.NODE_ENV': JSON.stringify(env) +// }), +// url({ +// limit: 5 * 1024, +// publicPath: '/_client/' +// }) +// ] +// }; const secretKey = require('./secretKey'); const fnsPkg = require('./functions/package.json'); @@ -127,4 +168,4 @@ const functions = [ }) ); -module.exports = [client].concat(functions); +module.exports = client.concat(functions);