diff --git a/README.md b/README.md index 2ae2a719..f8989b55 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # SystemJS -[![Build Status][travis-image]][travis-url] +[![Build Status](https://travis-ci.com/systemjs/systemjs.svg?branch=master)](https://travis-ci.com/systemjs/systemjs) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/systemjs/systemjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Backers on Open Collective](https://opencollective.com/systemjs/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/systemjs/sponsors/badge.svg)](#sponsors) diff --git a/package.json b/package.json index f2737e1b..ebdafb98 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "cross-env": "^7.0.2", "make-fetch-happen": "^8.0.4", "mocha": "^7.1.1", - "opn": "^6.0.0", + "open": "^7.0.3", "rimraf": "^3.0.2", "rollup": "^2.2.0", "rollup-plugin-terser": "^5.3.0", @@ -42,12 +42,12 @@ "build:node": "node --experimental-modules build-node.js", "build:browser:prod": "rollup -c", "build:browser:dev": "rollup -c --environment dev", - "footprint": "npm run footprint:systemjs && npm run footprint:sjs", + "footprint": "concurrently -n w: 'npm:footprint:*'", "footprint:systemjs": "cat dist/system.min.js | gzip -9f | wc -c", "footprint:sjs": "cat dist/s.min.js | gzip -9f | wc -c", "test": "concurrently -n w: 'npm:test:*'", - "test:internals": "NODE_OPTIONS=--experimental-modules mocha -b --file test/mocha-setup.js test/import-map.js test/system-core.js test/url-resolution.js", - "test:node": "NODE_OPTIONS=--experimental-modules mocha -b --file test/mocha-setup.js test/system-node.js", + "test:internals": "cross-env NODE_OPTIONS=--experimental-modules mocha -b --file test/mocha-setup.js test/import-map.js test/system-core.js test/url-resolution.js", + "test:node": "cross-env NODE_OPTIONS=--experimental-modules mocha -b --file test/mocha-setup.js test/system-node.js", "test:browser": "node test/server.cjs", "test-browser-watch": "cross-env WATCH_MODE=true node test/server.cjs", "prepublish": "npm run build" diff --git a/src/features/import-map.js b/src/features/import-map.js index c87be308..ed88a72a 100644 --- a/src/features/import-map.js +++ b/src/features/import-map.js @@ -14,6 +14,8 @@ import { BASE_URL, baseUrl, resolveAndComposeImportMap, resolveImportMap, resolv import { systemJSPrototype } from '../system-core.js'; import { errMsg } from '../err-msg.js'; +export { IMPORT_MAP }; + var IMPORT_MAP = hasSymbol ? Symbol() : '#'; var IMPORT_MAP_PROMISE = hasSymbol ? Symbol() : '$'; diff --git a/src/system-node.js b/src/system-node.js index 67050510..be0b1146 100644 --- a/src/system-node.js +++ b/src/system-node.js @@ -1,11 +1,10 @@ -import './system-node-baseurl.js'; - +import { REGISTRY } from './system-core.js'; import { IMPORT_MAP } from './features/import-map.js'; import './features/registry.js'; import './extras/global.js'; import './extras/module-types.js'; import './features/node-fetch.js'; -import { BASE_URL } from './common.js'; +import { BASE_URL, baseUrl, resolveAndComposeImportMap } from './common.js'; export const System = global.System; @@ -22,6 +21,6 @@ export function setBaseUrl(loader, url) { } function ensureValidSystemLoader (loader) { - if (!loader[IMPORT_MAP]) + if (!loader[REGISTRY]) throw new Error('A valid SystemJS instance must be provided'); } diff --git a/test/server.cjs b/test/server.cjs index 22a5fcc1..e267b9f6 100644 --- a/test/server.cjs +++ b/test/server.cjs @@ -3,7 +3,7 @@ const fs = require('fs'); const path = require('path'); const { once } = require('events'); const { pathToFileURL, fileURLToPath } = require('url'); -const opn = require('opn'); +const open = require('open'); const port = 8080; @@ -96,4 +96,5 @@ http.createServer(async function (req, res) { }).listen(port); console.log(`Test server listening on http://localhost:${port}\n`); -opn(`http://localhost:${port}/test/test.html`); +const openOptions = process.env.CI ? { app: ['firefox'] } : {}; +open(`http://localhost:${port}/test/test.html`, openOptions); diff --git a/test/system-node.js b/test/system-node.js index 267018df..3c117a6b 100644 --- a/test/system-node.js +++ b/test/system-node.js @@ -31,7 +31,7 @@ describe('NodeJS version of SystemJS', () => { }); it('allows the base URL to be set to a valid full URL', () => { - setBaseUrl('http://localhost:9650/some-prefix/'); + setBaseUrl(System, 'http://localhost:9650/some-prefix/'); assert.equal(System.resolve('./foo.js'), 'http://localhost:9650/some-prefix/foo.js'); }); });