Skip to content

Commit 2d377db

Browse files
committed
feat: init systemjs-unpkg
0 parents  commit 2d377db

13 files changed

+10735
-0
lines changed

.editorconfig

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
end_of_line = lf
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/workflows/release.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Release
2+
on:
3+
push:
4+
branches: [ master, next, next-major, beta, alpha ]
5+
jobs:
6+
release:
7+
name: Release
8+
runs-on: ubuntu-latest
9+
timeout-minutes: 10
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
- name: Use Node.js ${{ matrix.node-version }}
14+
uses: actions/setup-node@v1
15+
with:
16+
node-version: 14.x
17+
- name: Install dependencies
18+
run: npm ci
19+
- name: Lint
20+
run: npm run lint
21+
- name: Test
22+
run: npm run test --if-present
23+
- name: Build
24+
run: npm run build --if-present
25+
- name: Release
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
29+
run: npx semantic-release

.github/workflows/test.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test
2+
on:
3+
push:
4+
branches: [ develop ]
5+
pull_request:
6+
branches: [ develop, master, next, next-major, beta, alpha ]
7+
jobs:
8+
test:
9+
name: Test
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 10
12+
strategy:
13+
matrix:
14+
node-version: [ 10.x, 14.x ]
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
- name: Install dependencies
23+
run: npm ci
24+
- name: Lint
25+
run: npm run lint
26+
- name: Test
27+
run: npm run test --if-present

.gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# macOS
2+
.DS_Store
3+
4+
# Logs
5+
logs
6+
*.log
7+
8+
# Node dependency directory
9+
node_modules
10+
11+
# Output of 'npm pack'
12+
*.tgz
13+
14+
# dotenv environment variables file
15+
.env
16+
.env.test
17+
18+
# Bundle output
19+
dist

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v12.18.4

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# systemjs-unpkg [![Latest version](https://badgen.net/npm/v/systemjs-unpkg)](https://npm.im/systemjs-unpkg) [![Monthly downloads](https://badgen.net/npm/dm/systemjs-unpkg)](https://npm.im/systemjs-unpkg) [![Install size](https://packagephobia.now.sh/badge?p=systemjs-unpkg)](https://packagephobia.now.sh/result?p=systemjs-unpkg) [![Bundle size](https://badgen.net/bundlephobia/minzip/systemjs-unpkg)](https://bundlephobia.com/result?p=systemjs-unpkg)
2+
3+
Auto-resolve bare specifiers in [SystemJS](https://github.com/systemjs/systemjs) using [UNPKG](https://unpkg.com)
4+
5+
**Before**
6+
7+
```html
8+
<script type="systemjs-importmap">
9+
{
10+
"imports": {
11+
"lodash/": "//unpkg.com/lodash/",
12+
...
13+
}
14+
}
15+
</script>
16+
```
17+
18+
```js
19+
const _ = await System.import('lodash'); // ⬅ Won't work unless the import map above is defined
20+
```
21+
22+
**After**
23+
24+
```js
25+
const _ = await System.import('lodash'); // ⬅ Automatically resolved without import map
26+
```
27+
28+
## 🙋‍♂️ Why?
29+
- **⚡️ Simplify SystemJS setup** Zero config setup to seemlessly resolve arbitrary bare specifiers!
30+
- **🔥 Import map fallback** Only resolves specifiers that aren't defined in your [import map](https://github.com/systemjs/systemjs/blob/master/docs/import-maps.md)!
31+
- **🐥 Tiny** Only `255B`!
32+
33+
## 🚀 Install
34+
```sh
35+
npm i systemjs-unpkg
36+
```
37+
38+
## 🚦 Quick Setup
39+
Simply load `systemjs-unpkg` after you load SystemJS.
40+
41+
If you're using a JS bundler:
42+
43+
```js
44+
// Load systemjs
45+
import 'systemjs';
46+
47+
// Load the systemjs AMD extra, as most npm packages have UMD/AMD distributions
48+
import 'systemjs/dist/extras/amd';
49+
50+
// Load systemjs-unpkg
51+
import 'systemjs-unpkg';
52+
```
53+
54+
If in a browser:
55+
56+
```html
57+
<!-- Load systemjs -->
58+
<script src="//unpkg.com/systemjs/dist/system.min.js"></script>
59+
60+
<!-- Load the systemjs AMD extra, as most npm packages have UMD/AMD distributions -->
61+
<script src="//unpkg.com/systemjs/dist/extras/amd.min.js"></script>
62+
63+
<!-- Load systemjs-unpkg -->
64+
<script src="//unpkg.com/systemjs-unpkg"></script>
65+
```
66+

0 commit comments

Comments
 (0)