jiek 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/jiek-dev.js +4 -0
- package/bin/jiek.js +2 -0
- package/dist/commands/build.esm.js +68 -0
- package/dist/commands/build.esm.js.map +1 -0
- package/dist/commands/build.esm.min.js +2 -0
- package/dist/commands/build.esm.min.js.map +1 -0
- package/dist/commands/publish.esm.js +60 -0
- package/dist/commands/publish.esm.js.map +1 -0
- package/dist/commands/publish.esm.min.js +2 -0
- package/dist/commands/publish.esm.min.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.d.ts +2 -0
- package/dist/index.esm.js +6 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.esm.min.js +2 -0
- package/dist/index.esm.min.js.map +1 -0
- package/dist/index.iife.js +155 -0
- package/dist/index.iife.js.map +1 -0
- package/dist/index.iife.min.js +2 -0
- package/dist/index.iife.min.js.map +1 -0
- package/dist/index.umd.js +158 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/index.umd.min.js +2 -0
- package/dist/index.umd.min.js.map +1 -0
- package/dist/inner.esm.js +10 -0
- package/dist/inner.esm.js.map +1 -0
- package/dist/inner.esm.min.js +2 -0
- package/dist/inner.esm.min.js.map +1 -0
- package/dist/merge-package-json.esm.js +16 -0
- package/dist/merge-package-json.esm.js.map +1 -0
- package/dist/merge-package-json.esm.min.js +2 -0
- package/dist/merge-package-json.esm.min.js.map +1 -0
- package/package.json +56 -0
- package/src/commands/build.ts +91 -0
- package/src/commands/publish.ts +79 -0
- package/src/index.ts +6 -0
- package/src/inner.ts +11 -0
- package/src/merge-package-json.ts +19 -0
- package/src/rollup/index.ts +162 -0
- package/src/rollup/plugins/globals.ts +34 -0
- package/src/rollup/plugins/skip.ts +23 -0
- package/src/rollup/utils/commonOptions.ts +9 -0
- package/src/rollup/utils/externalResolver.ts +11 -0
- package/src/rollup/utils/globalResolver.ts +24 -0
- package/src/rollup/utils/withMinify.ts +16 -0
- package/tests/build.spec.ts +28 -0
- package/tests/fixtures/node_modules/.bin/jiek +17 -0
- package/tests/fixtures/node_modules/.jiek/jiek+test-foo.rollup.config.js +31 -0
- package/tests/fixtures/node_modules/.modules.yaml +95 -0
- package/tests/fixtures/node_modules/.pnpm/@esbuild+darwin-arm64@0.20.2/node_modules/@esbuild/darwin-arm64/README.md +3 -0
- package/tests/fixtures/node_modules/.pnpm/@esbuild+darwin-arm64@0.20.2/node_modules/@esbuild/darwin-arm64/bin/esbuild +0 -0
- package/tests/fixtures/node_modules/.pnpm/@esbuild+darwin-arm64@0.20.2/node_modules/@esbuild/darwin-arm64/package.json +20 -0
- package/tests/fixtures/node_modules/.pnpm/@jiek+loader-esbuild@1.0.0_esbuild@0.20.2/node_modules/@jiek/loader-esbuild/LICENSE +21 -0
- package/tests/fixtures/node_modules/.pnpm/@jiek+loader-esbuild@1.0.0_esbuild@0.20.2/node_modules/@jiek/loader-esbuild/loader.js +3 -0
- package/tests/fixtures/node_modules/.pnpm/@jiek+loader-esbuild@1.0.0_esbuild@0.20.2/node_modules/@jiek/loader-esbuild/package.json +8 -0
- package/tests/fixtures/node_modules/.pnpm/debug@4.3.4/node_modules/debug/LICENSE +20 -0
- package/tests/fixtures/node_modules/.pnpm/debug@4.3.4/node_modules/debug/README.md +481 -0
- package/tests/fixtures/node_modules/.pnpm/debug@4.3.4/node_modules/debug/package.json +59 -0
- package/tests/fixtures/node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/browser.js +269 -0
- package/tests/fixtures/node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/common.js +274 -0
- package/tests/fixtures/node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/index.js +10 -0
- package/tests/fixtures/node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/node.js +263 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/LICENSE +21 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/README.md +50 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/dist/loader.d.ts +3 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/dist/loader.js +15 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/dist/node.d.ts +23 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/dist/node.js +4926 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/loader.js +1 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/node_modules/.bin/esbuild +14 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/package.json +46 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/register.js +3 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/LICENSE.md +21 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/README.md +3 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/bin/esbuild +0 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/install.js +288 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.d.ts +703 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js +2436 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/node_modules/.bin/esbuild +14 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/package.json +46 -0
- package/tests/fixtures/node_modules/.pnpm/lock.yaml +291 -0
- package/tests/fixtures/node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js +162 -0
- package/tests/fixtures/node_modules/.pnpm/ms@2.1.2/node_modules/ms/license.md +21 -0
- package/tests/fixtures/node_modules/.pnpm/ms@2.1.2/node_modules/ms/package.json +37 -0
- package/tests/fixtures/node_modules/.pnpm/ms@2.1.2/node_modules/ms/readme.md +60 -0
- package/tests/fixtures/node_modules/.pnpm/node_modules/.bin/esbuild +14 -0
- package/tests/fixtures/package.json +8 -0
- package/tests/fixtures/packages/bar/package.json +4 -0
- package/tests/fixtures/packages/foo/dist/index.d.ts +3 -0
- package/tests/fixtures/packages/foo/dist/index.esm.d.ts +3 -0
- package/tests/fixtures/packages/foo/dist/index.esm.js +6 -0
- package/tests/fixtures/packages/foo/dist/index.esm.js.map +1 -0
- package/tests/fixtures/packages/foo/dist/index.esm.min.js +2 -0
- package/tests/fixtures/packages/foo/dist/index.esm.min.js.map +1 -0
- package/tests/fixtures/packages/foo/dist/index.iife.js +15 -0
- package/tests/fixtures/packages/foo/dist/index.iife.js.map +1 -0
- package/tests/fixtures/packages/foo/dist/index.iife.min.js +2 -0
- package/tests/fixtures/packages/foo/dist/index.iife.min.js.map +1 -0
- package/tests/fixtures/packages/foo/dist/index.umd.js +16 -0
- package/tests/fixtures/packages/foo/dist/index.umd.js.map +1 -0
- package/tests/fixtures/packages/foo/dist/index.umd.min.js +2 -0
- package/tests/fixtures/packages/foo/dist/index.umd.min.js.map +1 -0
- package/tests/fixtures/packages/foo/package.json +7 -0
- package/tests/fixtures/packages/foo/src/index.ts +3 -0
- package/tests/fixtures/pnpm-workspace.yaml +2 -0
- package/tests/publish.spec.ts +31 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
3
|
+
|
4
|
+
case `uname` in
|
5
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
6
|
+
esac
|
7
|
+
|
8
|
+
if [ -z "$NODE_PATH" ]; then
|
9
|
+
export NODE_PATH="/Users/yijie/codes/projects/jiek/packages/jiek/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/bin/node_modules:/Users/yijie/codes/projects/jiek/packages/jiek/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/node_modules:/Users/yijie/codes/projects/jiek/packages/jiek/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules:/Users/yijie/codes/projects/jiek/packages/jiek/tests/fixtures/node_modules/.pnpm/node_modules"
|
10
|
+
else
|
11
|
+
export NODE_PATH="/Users/yijie/codes/projects/jiek/packages/jiek/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/bin/node_modules:/Users/yijie/codes/projects/jiek/packages/jiek/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/node_modules:/Users/yijie/codes/projects/jiek/packages/jiek/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules:/Users/yijie/codes/projects/jiek/packages/jiek/tests/fixtures/node_modules/.pnpm/node_modules:$NODE_PATH"
|
12
|
+
fi
|
13
|
+
"$basedir/../../bin/esbuild" "$@"
|
14
|
+
exit $?
|
@@ -0,0 +1,46 @@
|
|
1
|
+
{
|
2
|
+
"name": "esbuild",
|
3
|
+
"version": "0.20.2",
|
4
|
+
"description": "An extremely fast JavaScript and CSS bundler and minifier.",
|
5
|
+
"repository": {
|
6
|
+
"type": "git",
|
7
|
+
"url": "git+https://github.com/evanw/esbuild.git"
|
8
|
+
},
|
9
|
+
"scripts": {
|
10
|
+
"postinstall": "node install.js"
|
11
|
+
},
|
12
|
+
"main": "lib/main.js",
|
13
|
+
"types": "lib/main.d.ts",
|
14
|
+
"engines": {
|
15
|
+
"node": ">=12"
|
16
|
+
},
|
17
|
+
"bin": {
|
18
|
+
"esbuild": "bin/esbuild"
|
19
|
+
},
|
20
|
+
"optionalDependencies": {
|
21
|
+
"@esbuild/aix-ppc64": "0.20.2",
|
22
|
+
"@esbuild/android-arm": "0.20.2",
|
23
|
+
"@esbuild/android-arm64": "0.20.2",
|
24
|
+
"@esbuild/android-x64": "0.20.2",
|
25
|
+
"@esbuild/darwin-arm64": "0.20.2",
|
26
|
+
"@esbuild/darwin-x64": "0.20.2",
|
27
|
+
"@esbuild/freebsd-arm64": "0.20.2",
|
28
|
+
"@esbuild/freebsd-x64": "0.20.2",
|
29
|
+
"@esbuild/linux-arm": "0.20.2",
|
30
|
+
"@esbuild/linux-arm64": "0.20.2",
|
31
|
+
"@esbuild/linux-ia32": "0.20.2",
|
32
|
+
"@esbuild/linux-loong64": "0.20.2",
|
33
|
+
"@esbuild/linux-mips64el": "0.20.2",
|
34
|
+
"@esbuild/linux-ppc64": "0.20.2",
|
35
|
+
"@esbuild/linux-riscv64": "0.20.2",
|
36
|
+
"@esbuild/linux-s390x": "0.20.2",
|
37
|
+
"@esbuild/linux-x64": "0.20.2",
|
38
|
+
"@esbuild/netbsd-x64": "0.20.2",
|
39
|
+
"@esbuild/openbsd-x64": "0.20.2",
|
40
|
+
"@esbuild/sunos-x64": "0.20.2",
|
41
|
+
"@esbuild/win32-arm64": "0.20.2",
|
42
|
+
"@esbuild/win32-ia32": "0.20.2",
|
43
|
+
"@esbuild/win32-x64": "0.20.2"
|
44
|
+
},
|
45
|
+
"license": "MIT"
|
46
|
+
}
|
@@ -0,0 +1,291 @@
|
|
1
|
+
lockfileVersion: '6.0'
|
2
|
+
|
3
|
+
settings:
|
4
|
+
autoInstallPeers: true
|
5
|
+
excludeLinksFromLockfile: false
|
6
|
+
|
7
|
+
importers:
|
8
|
+
|
9
|
+
.:
|
10
|
+
devDependencies:
|
11
|
+
esbuild-register:
|
12
|
+
specifier: ^3.5.0
|
13
|
+
version: 3.5.0(esbuild@0.20.2)
|
14
|
+
jiek:
|
15
|
+
specifier: ln:../../../../
|
16
|
+
version: link:../..
|
17
|
+
|
18
|
+
packages/bar: {}
|
19
|
+
|
20
|
+
packages/foo:
|
21
|
+
dependencies:
|
22
|
+
'@jiek/test-bar':
|
23
|
+
specifier: workspace:^*
|
24
|
+
version: link:../bar
|
25
|
+
|
26
|
+
packages:
|
27
|
+
|
28
|
+
/@esbuild/aix-ppc64@0.20.2:
|
29
|
+
resolution: {integrity: sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==}
|
30
|
+
engines: {node: '>=12'}
|
31
|
+
cpu: [ppc64]
|
32
|
+
os: [aix]
|
33
|
+
requiresBuild: true
|
34
|
+
dev: true
|
35
|
+
optional: true
|
36
|
+
|
37
|
+
/@esbuild/android-arm64@0.20.2:
|
38
|
+
resolution: {integrity: sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg==}
|
39
|
+
engines: {node: '>=12'}
|
40
|
+
cpu: [arm64]
|
41
|
+
os: [android]
|
42
|
+
requiresBuild: true
|
43
|
+
dev: true
|
44
|
+
optional: true
|
45
|
+
|
46
|
+
/@esbuild/android-arm@0.20.2:
|
47
|
+
resolution: {integrity: sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w==}
|
48
|
+
engines: {node: '>=12'}
|
49
|
+
cpu: [arm]
|
50
|
+
os: [android]
|
51
|
+
requiresBuild: true
|
52
|
+
dev: true
|
53
|
+
optional: true
|
54
|
+
|
55
|
+
/@esbuild/android-x64@0.20.2:
|
56
|
+
resolution: {integrity: sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg==}
|
57
|
+
engines: {node: '>=12'}
|
58
|
+
cpu: [x64]
|
59
|
+
os: [android]
|
60
|
+
requiresBuild: true
|
61
|
+
dev: true
|
62
|
+
optional: true
|
63
|
+
|
64
|
+
/@esbuild/darwin-arm64@0.20.2:
|
65
|
+
resolution: {integrity: sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA==}
|
66
|
+
engines: {node: '>=12'}
|
67
|
+
cpu: [arm64]
|
68
|
+
os: [darwin]
|
69
|
+
requiresBuild: true
|
70
|
+
dev: true
|
71
|
+
optional: true
|
72
|
+
|
73
|
+
/@esbuild/darwin-x64@0.20.2:
|
74
|
+
resolution: {integrity: sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==}
|
75
|
+
engines: {node: '>=12'}
|
76
|
+
cpu: [x64]
|
77
|
+
os: [darwin]
|
78
|
+
requiresBuild: true
|
79
|
+
dev: true
|
80
|
+
optional: true
|
81
|
+
|
82
|
+
/@esbuild/freebsd-arm64@0.20.2:
|
83
|
+
resolution: {integrity: sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw==}
|
84
|
+
engines: {node: '>=12'}
|
85
|
+
cpu: [arm64]
|
86
|
+
os: [freebsd]
|
87
|
+
requiresBuild: true
|
88
|
+
dev: true
|
89
|
+
optional: true
|
90
|
+
|
91
|
+
/@esbuild/freebsd-x64@0.20.2:
|
92
|
+
resolution: {integrity: sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw==}
|
93
|
+
engines: {node: '>=12'}
|
94
|
+
cpu: [x64]
|
95
|
+
os: [freebsd]
|
96
|
+
requiresBuild: true
|
97
|
+
dev: true
|
98
|
+
optional: true
|
99
|
+
|
100
|
+
/@esbuild/linux-arm64@0.20.2:
|
101
|
+
resolution: {integrity: sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A==}
|
102
|
+
engines: {node: '>=12'}
|
103
|
+
cpu: [arm64]
|
104
|
+
os: [linux]
|
105
|
+
requiresBuild: true
|
106
|
+
dev: true
|
107
|
+
optional: true
|
108
|
+
|
109
|
+
/@esbuild/linux-arm@0.20.2:
|
110
|
+
resolution: {integrity: sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg==}
|
111
|
+
engines: {node: '>=12'}
|
112
|
+
cpu: [arm]
|
113
|
+
os: [linux]
|
114
|
+
requiresBuild: true
|
115
|
+
dev: true
|
116
|
+
optional: true
|
117
|
+
|
118
|
+
/@esbuild/linux-ia32@0.20.2:
|
119
|
+
resolution: {integrity: sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig==}
|
120
|
+
engines: {node: '>=12'}
|
121
|
+
cpu: [ia32]
|
122
|
+
os: [linux]
|
123
|
+
requiresBuild: true
|
124
|
+
dev: true
|
125
|
+
optional: true
|
126
|
+
|
127
|
+
/@esbuild/linux-loong64@0.20.2:
|
128
|
+
resolution: {integrity: sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ==}
|
129
|
+
engines: {node: '>=12'}
|
130
|
+
cpu: [loong64]
|
131
|
+
os: [linux]
|
132
|
+
requiresBuild: true
|
133
|
+
dev: true
|
134
|
+
optional: true
|
135
|
+
|
136
|
+
/@esbuild/linux-mips64el@0.20.2:
|
137
|
+
resolution: {integrity: sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA==}
|
138
|
+
engines: {node: '>=12'}
|
139
|
+
cpu: [mips64el]
|
140
|
+
os: [linux]
|
141
|
+
requiresBuild: true
|
142
|
+
dev: true
|
143
|
+
optional: true
|
144
|
+
|
145
|
+
/@esbuild/linux-ppc64@0.20.2:
|
146
|
+
resolution: {integrity: sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg==}
|
147
|
+
engines: {node: '>=12'}
|
148
|
+
cpu: [ppc64]
|
149
|
+
os: [linux]
|
150
|
+
requiresBuild: true
|
151
|
+
dev: true
|
152
|
+
optional: true
|
153
|
+
|
154
|
+
/@esbuild/linux-riscv64@0.20.2:
|
155
|
+
resolution: {integrity: sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg==}
|
156
|
+
engines: {node: '>=12'}
|
157
|
+
cpu: [riscv64]
|
158
|
+
os: [linux]
|
159
|
+
requiresBuild: true
|
160
|
+
dev: true
|
161
|
+
optional: true
|
162
|
+
|
163
|
+
/@esbuild/linux-s390x@0.20.2:
|
164
|
+
resolution: {integrity: sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ==}
|
165
|
+
engines: {node: '>=12'}
|
166
|
+
cpu: [s390x]
|
167
|
+
os: [linux]
|
168
|
+
requiresBuild: true
|
169
|
+
dev: true
|
170
|
+
optional: true
|
171
|
+
|
172
|
+
/@esbuild/linux-x64@0.20.2:
|
173
|
+
resolution: {integrity: sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw==}
|
174
|
+
engines: {node: '>=12'}
|
175
|
+
cpu: [x64]
|
176
|
+
os: [linux]
|
177
|
+
requiresBuild: true
|
178
|
+
dev: true
|
179
|
+
optional: true
|
180
|
+
|
181
|
+
/@esbuild/netbsd-x64@0.20.2:
|
182
|
+
resolution: {integrity: sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ==}
|
183
|
+
engines: {node: '>=12'}
|
184
|
+
cpu: [x64]
|
185
|
+
os: [netbsd]
|
186
|
+
requiresBuild: true
|
187
|
+
dev: true
|
188
|
+
optional: true
|
189
|
+
|
190
|
+
/@esbuild/openbsd-x64@0.20.2:
|
191
|
+
resolution: {integrity: sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ==}
|
192
|
+
engines: {node: '>=12'}
|
193
|
+
cpu: [x64]
|
194
|
+
os: [openbsd]
|
195
|
+
requiresBuild: true
|
196
|
+
dev: true
|
197
|
+
optional: true
|
198
|
+
|
199
|
+
/@esbuild/sunos-x64@0.20.2:
|
200
|
+
resolution: {integrity: sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w==}
|
201
|
+
engines: {node: '>=12'}
|
202
|
+
cpu: [x64]
|
203
|
+
os: [sunos]
|
204
|
+
requiresBuild: true
|
205
|
+
dev: true
|
206
|
+
optional: true
|
207
|
+
|
208
|
+
/@esbuild/win32-arm64@0.20.2:
|
209
|
+
resolution: {integrity: sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ==}
|
210
|
+
engines: {node: '>=12'}
|
211
|
+
cpu: [arm64]
|
212
|
+
os: [win32]
|
213
|
+
requiresBuild: true
|
214
|
+
dev: true
|
215
|
+
optional: true
|
216
|
+
|
217
|
+
/@esbuild/win32-ia32@0.20.2:
|
218
|
+
resolution: {integrity: sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ==}
|
219
|
+
engines: {node: '>=12'}
|
220
|
+
cpu: [ia32]
|
221
|
+
os: [win32]
|
222
|
+
requiresBuild: true
|
223
|
+
dev: true
|
224
|
+
optional: true
|
225
|
+
|
226
|
+
/@esbuild/win32-x64@0.20.2:
|
227
|
+
resolution: {integrity: sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ==}
|
228
|
+
engines: {node: '>=12'}
|
229
|
+
cpu: [x64]
|
230
|
+
os: [win32]
|
231
|
+
requiresBuild: true
|
232
|
+
dev: true
|
233
|
+
optional: true
|
234
|
+
|
235
|
+
/debug@4.3.4:
|
236
|
+
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
|
237
|
+
engines: {node: '>=6.0'}
|
238
|
+
peerDependencies:
|
239
|
+
supports-color: '*'
|
240
|
+
peerDependenciesMeta:
|
241
|
+
supports-color:
|
242
|
+
optional: true
|
243
|
+
dependencies:
|
244
|
+
ms: 2.1.2
|
245
|
+
dev: true
|
246
|
+
|
247
|
+
/esbuild-register@3.5.0(esbuild@0.20.2):
|
248
|
+
resolution: {integrity: sha512-+4G/XmakeBAsvJuDugJvtyF1x+XJT4FMocynNpxrvEBViirpfUn2PgNpCHedfWhF4WokNsO/OvMKrmJOIJsI5A==}
|
249
|
+
peerDependencies:
|
250
|
+
esbuild: '>=0.12 <1'
|
251
|
+
dependencies:
|
252
|
+
debug: 4.3.4
|
253
|
+
esbuild: 0.20.2
|
254
|
+
transitivePeerDependencies:
|
255
|
+
- supports-color
|
256
|
+
dev: true
|
257
|
+
|
258
|
+
/esbuild@0.20.2:
|
259
|
+
resolution: {integrity: sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==}
|
260
|
+
engines: {node: '>=12'}
|
261
|
+
hasBin: true
|
262
|
+
requiresBuild: true
|
263
|
+
optionalDependencies:
|
264
|
+
'@esbuild/aix-ppc64': 0.20.2
|
265
|
+
'@esbuild/android-arm': 0.20.2
|
266
|
+
'@esbuild/android-arm64': 0.20.2
|
267
|
+
'@esbuild/android-x64': 0.20.2
|
268
|
+
'@esbuild/darwin-arm64': 0.20.2
|
269
|
+
'@esbuild/darwin-x64': 0.20.2
|
270
|
+
'@esbuild/freebsd-arm64': 0.20.2
|
271
|
+
'@esbuild/freebsd-x64': 0.20.2
|
272
|
+
'@esbuild/linux-arm': 0.20.2
|
273
|
+
'@esbuild/linux-arm64': 0.20.2
|
274
|
+
'@esbuild/linux-ia32': 0.20.2
|
275
|
+
'@esbuild/linux-loong64': 0.20.2
|
276
|
+
'@esbuild/linux-mips64el': 0.20.2
|
277
|
+
'@esbuild/linux-ppc64': 0.20.2
|
278
|
+
'@esbuild/linux-riscv64': 0.20.2
|
279
|
+
'@esbuild/linux-s390x': 0.20.2
|
280
|
+
'@esbuild/linux-x64': 0.20.2
|
281
|
+
'@esbuild/netbsd-x64': 0.20.2
|
282
|
+
'@esbuild/openbsd-x64': 0.20.2
|
283
|
+
'@esbuild/sunos-x64': 0.20.2
|
284
|
+
'@esbuild/win32-arm64': 0.20.2
|
285
|
+
'@esbuild/win32-ia32': 0.20.2
|
286
|
+
'@esbuild/win32-x64': 0.20.2
|
287
|
+
dev: true
|
288
|
+
|
289
|
+
/ms@2.1.2:
|
290
|
+
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
|
291
|
+
dev: true
|
@@ -0,0 +1,162 @@
|
|
1
|
+
/**
|
2
|
+
* Helpers.
|
3
|
+
*/
|
4
|
+
|
5
|
+
var s = 1000;
|
6
|
+
var m = s * 60;
|
7
|
+
var h = m * 60;
|
8
|
+
var d = h * 24;
|
9
|
+
var w = d * 7;
|
10
|
+
var y = d * 365.25;
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Parse or format the given `val`.
|
14
|
+
*
|
15
|
+
* Options:
|
16
|
+
*
|
17
|
+
* - `long` verbose formatting [false]
|
18
|
+
*
|
19
|
+
* @param {String|Number} val
|
20
|
+
* @param {Object} [options]
|
21
|
+
* @throws {Error} throw an error if val is not a non-empty string or a number
|
22
|
+
* @return {String|Number}
|
23
|
+
* @api public
|
24
|
+
*/
|
25
|
+
|
26
|
+
module.exports = function(val, options) {
|
27
|
+
options = options || {};
|
28
|
+
var type = typeof val;
|
29
|
+
if (type === 'string' && val.length > 0) {
|
30
|
+
return parse(val);
|
31
|
+
} else if (type === 'number' && isFinite(val)) {
|
32
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
33
|
+
}
|
34
|
+
throw new Error(
|
35
|
+
'val is not a non-empty string or a valid number. val=' +
|
36
|
+
JSON.stringify(val)
|
37
|
+
);
|
38
|
+
};
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Parse the given `str` and return milliseconds.
|
42
|
+
*
|
43
|
+
* @param {String} str
|
44
|
+
* @return {Number}
|
45
|
+
* @api private
|
46
|
+
*/
|
47
|
+
|
48
|
+
function parse(str) {
|
49
|
+
str = String(str);
|
50
|
+
if (str.length > 100) {
|
51
|
+
return;
|
52
|
+
}
|
53
|
+
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
54
|
+
str
|
55
|
+
);
|
56
|
+
if (!match) {
|
57
|
+
return;
|
58
|
+
}
|
59
|
+
var n = parseFloat(match[1]);
|
60
|
+
var type = (match[2] || 'ms').toLowerCase();
|
61
|
+
switch (type) {
|
62
|
+
case 'years':
|
63
|
+
case 'year':
|
64
|
+
case 'yrs':
|
65
|
+
case 'yr':
|
66
|
+
case 'y':
|
67
|
+
return n * y;
|
68
|
+
case 'weeks':
|
69
|
+
case 'week':
|
70
|
+
case 'w':
|
71
|
+
return n * w;
|
72
|
+
case 'days':
|
73
|
+
case 'day':
|
74
|
+
case 'd':
|
75
|
+
return n * d;
|
76
|
+
case 'hours':
|
77
|
+
case 'hour':
|
78
|
+
case 'hrs':
|
79
|
+
case 'hr':
|
80
|
+
case 'h':
|
81
|
+
return n * h;
|
82
|
+
case 'minutes':
|
83
|
+
case 'minute':
|
84
|
+
case 'mins':
|
85
|
+
case 'min':
|
86
|
+
case 'm':
|
87
|
+
return n * m;
|
88
|
+
case 'seconds':
|
89
|
+
case 'second':
|
90
|
+
case 'secs':
|
91
|
+
case 'sec':
|
92
|
+
case 's':
|
93
|
+
return n * s;
|
94
|
+
case 'milliseconds':
|
95
|
+
case 'millisecond':
|
96
|
+
case 'msecs':
|
97
|
+
case 'msec':
|
98
|
+
case 'ms':
|
99
|
+
return n;
|
100
|
+
default:
|
101
|
+
return undefined;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
/**
|
106
|
+
* Short format for `ms`.
|
107
|
+
*
|
108
|
+
* @param {Number} ms
|
109
|
+
* @return {String}
|
110
|
+
* @api private
|
111
|
+
*/
|
112
|
+
|
113
|
+
function fmtShort(ms) {
|
114
|
+
var msAbs = Math.abs(ms);
|
115
|
+
if (msAbs >= d) {
|
116
|
+
return Math.round(ms / d) + 'd';
|
117
|
+
}
|
118
|
+
if (msAbs >= h) {
|
119
|
+
return Math.round(ms / h) + 'h';
|
120
|
+
}
|
121
|
+
if (msAbs >= m) {
|
122
|
+
return Math.round(ms / m) + 'm';
|
123
|
+
}
|
124
|
+
if (msAbs >= s) {
|
125
|
+
return Math.round(ms / s) + 's';
|
126
|
+
}
|
127
|
+
return ms + 'ms';
|
128
|
+
}
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Long format for `ms`.
|
132
|
+
*
|
133
|
+
* @param {Number} ms
|
134
|
+
* @return {String}
|
135
|
+
* @api private
|
136
|
+
*/
|
137
|
+
|
138
|
+
function fmtLong(ms) {
|
139
|
+
var msAbs = Math.abs(ms);
|
140
|
+
if (msAbs >= d) {
|
141
|
+
return plural(ms, msAbs, d, 'day');
|
142
|
+
}
|
143
|
+
if (msAbs >= h) {
|
144
|
+
return plural(ms, msAbs, h, 'hour');
|
145
|
+
}
|
146
|
+
if (msAbs >= m) {
|
147
|
+
return plural(ms, msAbs, m, 'minute');
|
148
|
+
}
|
149
|
+
if (msAbs >= s) {
|
150
|
+
return plural(ms, msAbs, s, 'second');
|
151
|
+
}
|
152
|
+
return ms + ' ms';
|
153
|
+
}
|
154
|
+
|
155
|
+
/**
|
156
|
+
* Pluralization helper.
|
157
|
+
*/
|
158
|
+
|
159
|
+
function plural(ms, msAbs, n, name) {
|
160
|
+
var isPlural = msAbs >= n * 1.5;
|
161
|
+
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
162
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Zeit, Inc.
|
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.
|
@@ -0,0 +1,37 @@
|
|
1
|
+
{
|
2
|
+
"name": "ms",
|
3
|
+
"version": "2.1.2",
|
4
|
+
"description": "Tiny millisecond conversion utility",
|
5
|
+
"repository": "zeit/ms",
|
6
|
+
"main": "./index",
|
7
|
+
"files": [
|
8
|
+
"index.js"
|
9
|
+
],
|
10
|
+
"scripts": {
|
11
|
+
"precommit": "lint-staged",
|
12
|
+
"lint": "eslint lib/* bin/*",
|
13
|
+
"test": "mocha tests.js"
|
14
|
+
},
|
15
|
+
"eslintConfig": {
|
16
|
+
"extends": "eslint:recommended",
|
17
|
+
"env": {
|
18
|
+
"node": true,
|
19
|
+
"es6": true
|
20
|
+
}
|
21
|
+
},
|
22
|
+
"lint-staged": {
|
23
|
+
"*.js": [
|
24
|
+
"npm run lint",
|
25
|
+
"prettier --single-quote --write",
|
26
|
+
"git add"
|
27
|
+
]
|
28
|
+
},
|
29
|
+
"license": "MIT",
|
30
|
+
"devDependencies": {
|
31
|
+
"eslint": "4.12.1",
|
32
|
+
"expect.js": "0.3.1",
|
33
|
+
"husky": "0.14.3",
|
34
|
+
"lint-staged": "5.0.0",
|
35
|
+
"mocha": "4.0.1"
|
36
|
+
}
|
37
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# ms
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms)
|
4
|
+
[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit)
|
5
|
+
|
6
|
+
Use this package to easily convert various time formats to milliseconds.
|
7
|
+
|
8
|
+
## Examples
|
9
|
+
|
10
|
+
```js
|
11
|
+
ms('2 days') // 172800000
|
12
|
+
ms('1d') // 86400000
|
13
|
+
ms('10h') // 36000000
|
14
|
+
ms('2.5 hrs') // 9000000
|
15
|
+
ms('2h') // 7200000
|
16
|
+
ms('1m') // 60000
|
17
|
+
ms('5s') // 5000
|
18
|
+
ms('1y') // 31557600000
|
19
|
+
ms('100') // 100
|
20
|
+
ms('-3 days') // -259200000
|
21
|
+
ms('-1h') // -3600000
|
22
|
+
ms('-200') // -200
|
23
|
+
```
|
24
|
+
|
25
|
+
### Convert from Milliseconds
|
26
|
+
|
27
|
+
```js
|
28
|
+
ms(60000) // "1m"
|
29
|
+
ms(2 * 60000) // "2m"
|
30
|
+
ms(-3 * 60000) // "-3m"
|
31
|
+
ms(ms('10 hours')) // "10h"
|
32
|
+
```
|
33
|
+
|
34
|
+
### Time Format Written-Out
|
35
|
+
|
36
|
+
```js
|
37
|
+
ms(60000, { long: true }) // "1 minute"
|
38
|
+
ms(2 * 60000, { long: true }) // "2 minutes"
|
39
|
+
ms(-3 * 60000, { long: true }) // "-3 minutes"
|
40
|
+
ms(ms('10 hours'), { long: true }) // "10 hours"
|
41
|
+
```
|
42
|
+
|
43
|
+
## Features
|
44
|
+
|
45
|
+
- Works both in [Node.js](https://nodejs.org) and in the browser
|
46
|
+
- If a number is supplied to `ms`, a string with a unit is returned
|
47
|
+
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
|
48
|
+
- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
|
49
|
+
|
50
|
+
## Related Packages
|
51
|
+
|
52
|
+
- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
|
53
|
+
|
54
|
+
## Caught a Bug?
|
55
|
+
|
56
|
+
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
|
57
|
+
2. Link the package to the global module directory: `npm link`
|
58
|
+
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
|
59
|
+
|
60
|
+
As always, you can run the tests using: `npm test`
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
3
|
+
|
4
|
+
case `uname` in
|
5
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
6
|
+
esac
|
7
|
+
|
8
|
+
if [ -z "$NODE_PATH" ]; then
|
9
|
+
export NODE_PATH="/Users/yijie/codes/projects/jiek/packages/jiek/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/bin/node_modules:/Users/yijie/codes/projects/jiek/packages/jiek/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/node_modules:/Users/yijie/codes/projects/jiek/packages/jiek/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules:/Users/yijie/codes/projects/jiek/packages/jiek/tests/fixtures/node_modules/.pnpm/node_modules"
|
10
|
+
else
|
11
|
+
export NODE_PATH="/Users/yijie/codes/projects/jiek/packages/jiek/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/bin/node_modules:/Users/yijie/codes/projects/jiek/packages/jiek/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/node_modules:/Users/yijie/codes/projects/jiek/packages/jiek/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules:/Users/yijie/codes/projects/jiek/packages/jiek/tests/fixtures/node_modules/.pnpm/node_modules:$NODE_PATH"
|
12
|
+
fi
|
13
|
+
"$basedir/../esbuild/bin/esbuild" "$@"
|
14
|
+
exit $?
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sourcesContent":["export default function (a: number, b: string) {\n return a + b\n}\n"],"names":[],"mappings":"AAAA,cAAA,CAAyB,GAAW,CAAW,EAAA;AAC7C,EAAA,OAAO,CAAI,GAAA,CAAA,CAAA;AACb;;;;"}
|