@meethive/vite 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dynamic-remote.d.ts +2 -0
- package/dist/dynamic-remote.js +185 -0
- package/dist/dynamic-remote.mjs +163 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +9 -325
- package/dist/index.mjs +9 -303
- package/dist/satisfy.d.ts +2 -0
- package/dist/satisfy.js +381 -0
- package/dist/satisfy.mjs +381 -0
- package/package.json +20 -4
- package/dist/index.d.ts.map +0 -1
- package/dist/src/federation/src/dev/expose-development.d.ts +0 -5
- package/dist/src/federation/src/dev/expose-development.d.ts.map +0 -1
- package/dist/src/federation/src/dev/remote-development.d.ts +0 -5
- package/dist/src/federation/src/dev/remote-development.d.ts.map +0 -1
- package/dist/src/federation/src/dev/shared-development.d.ts +0 -5
- package/dist/src/federation/src/dev/shared-development.d.ts.map +0 -1
- package/dist/src/federation/src/index.d.ts +0 -7
- package/dist/src/federation/src/index.d.ts.map +0 -1
- package/dist/src/federation/src/prod/expose-production.d.ts +0 -5
- package/dist/src/federation/src/prod/expose-production.d.ts.map +0 -1
- package/dist/src/federation/src/prod/remote-production.d.ts +0 -7
- package/dist/src/federation/src/prod/remote-production.d.ts.map +0 -1
- package/dist/src/federation/src/prod/shared-production.d.ts +0 -5
- package/dist/src/federation/src/prod/shared-production.d.ts.map +0 -1
- package/dist/src/federation/src/public.d.ts +0 -40
- package/dist/src/federation/src/public.d.ts.map +0 -1
- package/dist/src/federation/src/runtime/dynamic-remote.d.ts +0 -79
- package/dist/src/federation/src/runtime/dynamic-remote.d.ts.map +0 -1
- package/dist/src/federation/src/utils/html.d.ts +0 -12
- package/dist/src/federation/src/utils/html.d.ts.map +0 -1
- package/dist/src/federation/src/utils/index.d.ts +0 -29
- package/dist/src/federation/src/utils/index.d.ts.map +0 -1
- package/dist/src/federation/src/utils/semver/compare.d.ts +0 -10
- package/dist/src/federation/src/utils/semver/compare.d.ts.map +0 -1
- package/dist/src/federation/src/utils/semver/constants.d.ts +0 -11
- package/dist/src/federation/src/utils/semver/constants.d.ts.map +0 -1
- package/dist/src/federation/src/utils/semver/parser.d.ts +0 -10
- package/dist/src/federation/src/utils/semver/parser.d.ts.map +0 -1
- package/dist/src/federation/src/utils/semver/satisfy.d.ts +0 -2
- package/dist/src/federation/src/utils/semver/satisfy.d.ts.map +0 -1
- package/dist/src/federation/src/utils/semver/utils.d.ts +0 -12
- package/dist/src/federation/src/utils/semver/utils.d.ts.map +0 -1
- package/dist/src/monaco-editor/index.d.ts +0 -35
- package/dist/src/monaco-editor/index.d.ts.map +0 -1
- package/dist/src/monaco-editor/languageWork.d.ts +0 -10
- package/dist/src/monaco-editor/languageWork.d.ts.map +0 -1
- package/dist/src/monaco-editor/workerMiddleware.d.ts +0 -9
- package/dist/src/monaco-editor/workerMiddleware.d.ts.map +0 -1
- package/dist/src/sharp/index.d.ts +0 -12
- package/dist/src/sharp/index.d.ts.map +0 -1
- package/index.ts +0 -3
- package/src/federation/src/dev/expose-development.ts +0 -29
- package/src/federation/src/dev/remote-development.ts +0 -435
- package/src/federation/src/dev/shared-development.ts +0 -29
- package/src/federation/src/index.ts +0 -242
- package/src/federation/src/prod/expose-production.ts +0 -333
- package/src/federation/src/prod/federation_fn_import.js +0 -75
- package/src/federation/src/prod/remote-production.ts +0 -658
- package/src/federation/src/prod/shared-production.ts +0 -268
- package/src/federation/src/public.ts +0 -54
- package/src/federation/src/runtime/dynamic-remote.ts +0 -247
- package/src/federation/src/utils/html.ts +0 -165
- package/src/federation/src/utils/index.ts +0 -255
- package/src/federation/src/utils/semver/compare.ts +0 -131
- package/src/federation/src/utils/semver/constants.ts +0 -46
- package/src/federation/src/utils/semver/parser.ts +0 -253
- package/src/federation/src/utils/semver/satisfy.ts +0 -151
- package/src/federation/src/utils/semver/utils.ts +0 -93
- package/src/federation/types/dynamic-remote.d.ts +0 -105
- package/src/federation/types/index.d.ts +0 -344
- package/src/federation/types/pluginHooks.d.ts +0 -4
- package/src/federation/types/virtual-modules.d.ts +0 -48
- package/src/federation/types/viteDevServer.d.ts +0 -22
- package/src/monaco-editor/index.ts +0 -205
- package/src/monaco-editor/languageWork.ts +0 -36
- package/src/monaco-editor/workerMiddleware.ts +0 -78
- package/src/sharp/index.ts +0 -93
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2022 Origin.js and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are licensed under Mulan PSL v2.
|
|
5
|
-
// You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
6
|
-
// You may obtain a copy of Mulan PSL v2 at:
|
|
7
|
-
// http://license.coscl.org.cn/MulanPSL2
|
|
8
|
-
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
9
|
-
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
10
|
-
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
11
|
-
// See the Mulan PSL v2 for more details.
|
|
12
|
-
//
|
|
13
|
-
// SPDX-License-Identifier: MulanPSL-2.0
|
|
14
|
-
// *****************************************************************************
|
|
15
|
-
|
|
16
|
-
import { isXVersion, parseRegex } from './utils'
|
|
17
|
-
import {
|
|
18
|
-
caret,
|
|
19
|
-
caretTrim,
|
|
20
|
-
comparatorTrim,
|
|
21
|
-
gte0,
|
|
22
|
-
hyphenRange,
|
|
23
|
-
star,
|
|
24
|
-
tilde,
|
|
25
|
-
tildeTrim,
|
|
26
|
-
xRange
|
|
27
|
-
} from './constants'
|
|
28
|
-
|
|
29
|
-
export function parseHyphen(range: string): string {
|
|
30
|
-
return range.replace(
|
|
31
|
-
parseRegex(hyphenRange),
|
|
32
|
-
(
|
|
33
|
-
_range,
|
|
34
|
-
from,
|
|
35
|
-
fromMajor,
|
|
36
|
-
fromMinor,
|
|
37
|
-
fromPatch,
|
|
38
|
-
_fromPreRelease,
|
|
39
|
-
_fromBuild,
|
|
40
|
-
to,
|
|
41
|
-
toMajor,
|
|
42
|
-
toMinor,
|
|
43
|
-
toPatch,
|
|
44
|
-
toPreRelease
|
|
45
|
-
) => {
|
|
46
|
-
if (isXVersion(fromMajor)) {
|
|
47
|
-
from = ''
|
|
48
|
-
} else if (isXVersion(fromMinor)) {
|
|
49
|
-
from = `>=${fromMajor}.0.0`
|
|
50
|
-
} else if (isXVersion(fromPatch)) {
|
|
51
|
-
from = `>=${fromMajor}.${fromMinor}.0`
|
|
52
|
-
} else {
|
|
53
|
-
from = `>=${from}`
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (isXVersion(toMajor)) {
|
|
57
|
-
to = ''
|
|
58
|
-
} else if (isXVersion(toMinor)) {
|
|
59
|
-
to = `<${+toMajor + 1}.0.0-0`
|
|
60
|
-
} else if (isXVersion(toPatch)) {
|
|
61
|
-
to = `<${toMajor}.${+toMinor + 1}.0-0`
|
|
62
|
-
} else if (toPreRelease) {
|
|
63
|
-
to = `<=${toMajor}.${toMinor}.${toPatch}-${toPreRelease}`
|
|
64
|
-
} else {
|
|
65
|
-
to = `<=${to}`
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return `${from} ${to}`.trim()
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export function parseComparatorTrim(range: string): string {
|
|
74
|
-
return range.replace(parseRegex(comparatorTrim), '$1$2$3')
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function parseTildeTrim(range: string): string {
|
|
78
|
-
return range.replace(parseRegex(tildeTrim), '$1~')
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function parseCaretTrim(range: string): string {
|
|
82
|
-
return range.replace(parseRegex(caretTrim), '$1^')
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export function parseCarets(range: string): string {
|
|
86
|
-
return range
|
|
87
|
-
.trim()
|
|
88
|
-
.split(/\s+/)
|
|
89
|
-
.map((rangeVersion) => {
|
|
90
|
-
return rangeVersion.replace(
|
|
91
|
-
parseRegex(caret),
|
|
92
|
-
(_, major, minor, patch, preRelease) => {
|
|
93
|
-
if (isXVersion(major)) {
|
|
94
|
-
return ''
|
|
95
|
-
} else if (isXVersion(minor)) {
|
|
96
|
-
return `>=${major}.0.0 <${+major + 1}.0.0-0`
|
|
97
|
-
} else if (isXVersion(patch)) {
|
|
98
|
-
if (major === '0') {
|
|
99
|
-
return `>=${major}.${minor}.0 <${major}.${+minor + 1}.0-0`
|
|
100
|
-
} else {
|
|
101
|
-
return `>=${major}.${minor}.0 <${+major + 1}.0.0-0`
|
|
102
|
-
}
|
|
103
|
-
} else if (preRelease) {
|
|
104
|
-
if (major === '0') {
|
|
105
|
-
if (minor === '0') {
|
|
106
|
-
return `>=${major}.${minor}.${patch}-${preRelease} <${major}.${minor}.${
|
|
107
|
-
+patch + 1
|
|
108
|
-
}-0`
|
|
109
|
-
} else {
|
|
110
|
-
return `>=${major}.${minor}.${patch}-${preRelease} <${major}.${
|
|
111
|
-
+minor + 1
|
|
112
|
-
}.0-0`
|
|
113
|
-
}
|
|
114
|
-
} else {
|
|
115
|
-
return `>=${major}.${minor}.${patch}-${preRelease} <${
|
|
116
|
-
+major + 1
|
|
117
|
-
}.0.0-0`
|
|
118
|
-
}
|
|
119
|
-
} else {
|
|
120
|
-
if (major === '0') {
|
|
121
|
-
if (minor === '0') {
|
|
122
|
-
return `>=${major}.${minor}.${patch} <${major}.${minor}.${
|
|
123
|
-
+patch + 1
|
|
124
|
-
}-0`
|
|
125
|
-
} else {
|
|
126
|
-
return `>=${major}.${minor}.${patch} <${major}.${
|
|
127
|
-
+minor + 1
|
|
128
|
-
}.0-0`
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return `>=${major}.${minor}.${patch} <${+major + 1}.0.0-0`
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
)
|
|
136
|
-
})
|
|
137
|
-
.join(' ')
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export function parseTildes(range: string): string {
|
|
141
|
-
return range
|
|
142
|
-
.trim()
|
|
143
|
-
.split(/\s+/)
|
|
144
|
-
.map((rangeVersion) => {
|
|
145
|
-
return rangeVersion.replace(
|
|
146
|
-
parseRegex(tilde),
|
|
147
|
-
(_, major, minor, patch, preRelease) => {
|
|
148
|
-
if (isXVersion(major)) {
|
|
149
|
-
return ''
|
|
150
|
-
} else if (isXVersion(minor)) {
|
|
151
|
-
return `>=${major}.0.0 <${+major + 1}.0.0-0`
|
|
152
|
-
} else if (isXVersion(patch)) {
|
|
153
|
-
return `>=${major}.${minor}.0 <${major}.${+minor + 1}.0-0`
|
|
154
|
-
} else if (preRelease) {
|
|
155
|
-
return `>=${major}.${minor}.${patch}-${preRelease} <${major}.${
|
|
156
|
-
+minor + 1
|
|
157
|
-
}.0-0`
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return `>=${major}.${minor}.${patch} <${major}.${+minor + 1}.0-0`
|
|
161
|
-
}
|
|
162
|
-
)
|
|
163
|
-
})
|
|
164
|
-
.join(' ')
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export function parseXRanges(range: string): string {
|
|
168
|
-
return range
|
|
169
|
-
.split(/\s+/)
|
|
170
|
-
.map((rangeVersion) => {
|
|
171
|
-
return rangeVersion
|
|
172
|
-
.trim()
|
|
173
|
-
.replace(
|
|
174
|
-
parseRegex(xRange),
|
|
175
|
-
(ret, gtlt, major, minor, patch, preRelease) => {
|
|
176
|
-
const isXMajor = isXVersion(major)
|
|
177
|
-
const isXMinor = isXMajor || isXVersion(minor)
|
|
178
|
-
const isXPatch = isXMinor || isXVersion(patch)
|
|
179
|
-
|
|
180
|
-
if (gtlt === '=' && isXPatch) {
|
|
181
|
-
gtlt = ''
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
preRelease = ''
|
|
185
|
-
|
|
186
|
-
if (isXMajor) {
|
|
187
|
-
if (gtlt === '>' || gtlt === '<') {
|
|
188
|
-
// nothing is allowed
|
|
189
|
-
return '<0.0.0-0'
|
|
190
|
-
} else {
|
|
191
|
-
// nothing is forbidden
|
|
192
|
-
return '*'
|
|
193
|
-
}
|
|
194
|
-
} else if (gtlt && isXPatch) {
|
|
195
|
-
// replace X with 0
|
|
196
|
-
if (isXMinor) {
|
|
197
|
-
minor = 0
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
patch = 0
|
|
201
|
-
|
|
202
|
-
if (gtlt === '>') {
|
|
203
|
-
// >1 => >=2.0.0
|
|
204
|
-
// >1.2 => >=1.3.0
|
|
205
|
-
gtlt = '>='
|
|
206
|
-
|
|
207
|
-
if (isXMinor) {
|
|
208
|
-
major = +major + 1
|
|
209
|
-
minor = 0
|
|
210
|
-
patch = 0
|
|
211
|
-
} else {
|
|
212
|
-
minor = +minor + 1
|
|
213
|
-
patch = 0
|
|
214
|
-
}
|
|
215
|
-
} else if (gtlt === '<=') {
|
|
216
|
-
// <=0.7.x is actually <0.8.0, since any 0.7.x should pass
|
|
217
|
-
// Similarly, <=7.x is actually <8.0.0, etc.
|
|
218
|
-
gtlt = '<'
|
|
219
|
-
|
|
220
|
-
if (isXMinor) {
|
|
221
|
-
major = +major + 1
|
|
222
|
-
} else {
|
|
223
|
-
minor = +minor + 1
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (gtlt === '<') {
|
|
228
|
-
preRelease = '-0'
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
return `${gtlt + major}.${minor}.${patch}${preRelease}`
|
|
232
|
-
} else if (isXMinor) {
|
|
233
|
-
return `>=${major}.0.0${preRelease} <${+major + 1}.0.0-0`
|
|
234
|
-
} else if (isXPatch) {
|
|
235
|
-
return `>=${major}.${minor}.0${preRelease} <${major}.${
|
|
236
|
-
+minor + 1
|
|
237
|
-
}.0-0`
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return ret
|
|
241
|
-
}
|
|
242
|
-
)
|
|
243
|
-
})
|
|
244
|
-
.join(' ')
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
export function parseStar(range: string): string {
|
|
248
|
-
return range.trim().replace(parseRegex(star), '')
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
export function parseGTE0(comparatorString: string): string {
|
|
252
|
-
return comparatorString.trim().replace(parseRegex(gte0), '')
|
|
253
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2022 Origin.js and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are licensed under Mulan PSL v2.
|
|
5
|
-
// You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
6
|
-
// You may obtain a copy of Mulan PSL v2 at:
|
|
7
|
-
// http://license.coscl.org.cn/MulanPSL2
|
|
8
|
-
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
9
|
-
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
10
|
-
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
11
|
-
// See the Mulan PSL v2 for more details.
|
|
12
|
-
//
|
|
13
|
-
// SPDX-License-Identifier: MulanPSL-2.0
|
|
14
|
-
// *****************************************************************************
|
|
15
|
-
|
|
16
|
-
import { combineVersion, extractComparator, pipe } from './utils'
|
|
17
|
-
import {
|
|
18
|
-
parseHyphen,
|
|
19
|
-
parseComparatorTrim,
|
|
20
|
-
parseTildeTrim,
|
|
21
|
-
parseCaretTrim,
|
|
22
|
-
parseCarets,
|
|
23
|
-
parseTildes,
|
|
24
|
-
parseXRanges,
|
|
25
|
-
parseStar,
|
|
26
|
-
parseGTE0
|
|
27
|
-
} from './parser'
|
|
28
|
-
import { compare } from './compare'
|
|
29
|
-
import type { CompareAtom } from './compare'
|
|
30
|
-
|
|
31
|
-
function parseComparatorString(range: string): string {
|
|
32
|
-
return pipe(
|
|
33
|
-
// handle caret
|
|
34
|
-
// ^ --> * (any, kinda silly)
|
|
35
|
-
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
|
|
36
|
-
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
|
|
37
|
-
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
|
|
38
|
-
// ^1.2.3 --> >=1.2.3 <2.0.0-0
|
|
39
|
-
// ^1.2.0 --> >=1.2.0 <2.0.0-0
|
|
40
|
-
parseCarets,
|
|
41
|
-
// handle tilde
|
|
42
|
-
// ~, ~> --> * (any, kinda silly)
|
|
43
|
-
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
|
|
44
|
-
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
|
|
45
|
-
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
|
|
46
|
-
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
|
|
47
|
-
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
|
|
48
|
-
parseTildes,
|
|
49
|
-
parseXRanges,
|
|
50
|
-
parseStar
|
|
51
|
-
)(range)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function parseRange(range: string) {
|
|
55
|
-
return pipe(
|
|
56
|
-
// handle hyphenRange
|
|
57
|
-
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
|
58
|
-
parseHyphen,
|
|
59
|
-
// handle trim comparator
|
|
60
|
-
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
|
61
|
-
parseComparatorTrim,
|
|
62
|
-
// handle trim tilde
|
|
63
|
-
// `~ 1.2.3` => `~1.2.3`
|
|
64
|
-
parseTildeTrim,
|
|
65
|
-
// handle trim caret
|
|
66
|
-
// `^ 1.2.3` => `^1.2.3`
|
|
67
|
-
parseCaretTrim
|
|
68
|
-
)(range.trim())
|
|
69
|
-
.split(/\s+/)
|
|
70
|
-
.join(' ')
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export function satisfy(version: string, range: string): boolean {
|
|
74
|
-
if (!version) {
|
|
75
|
-
return false
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const parsedRange = parseRange(range)
|
|
79
|
-
const parsedComparator = parsedRange
|
|
80
|
-
.split(' ')
|
|
81
|
-
.map((rangeVersion) => parseComparatorString(rangeVersion))
|
|
82
|
-
.join(' ')
|
|
83
|
-
const comparators = parsedComparator
|
|
84
|
-
.split(/\s+/)
|
|
85
|
-
.map((comparator) => parseGTE0(comparator))
|
|
86
|
-
const extractedVersion = extractComparator(version)
|
|
87
|
-
|
|
88
|
-
if (!extractedVersion) {
|
|
89
|
-
return false
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const [
|
|
93
|
-
,
|
|
94
|
-
versionOperator,
|
|
95
|
-
,
|
|
96
|
-
versionMajor,
|
|
97
|
-
versionMinor,
|
|
98
|
-
versionPatch,
|
|
99
|
-
versionPreRelease
|
|
100
|
-
] = extractedVersion
|
|
101
|
-
const versionAtom: CompareAtom = {
|
|
102
|
-
operator: versionOperator,
|
|
103
|
-
version: combineVersion(
|
|
104
|
-
versionMajor,
|
|
105
|
-
versionMinor,
|
|
106
|
-
versionPatch,
|
|
107
|
-
versionPreRelease
|
|
108
|
-
), // exclude build atom
|
|
109
|
-
major: versionMajor,
|
|
110
|
-
minor: versionMinor,
|
|
111
|
-
patch: versionPatch,
|
|
112
|
-
preRelease: versionPreRelease?.split('.')
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
for (const comparator of comparators) {
|
|
116
|
-
const extractedComparator = extractComparator(comparator)
|
|
117
|
-
|
|
118
|
-
if (!extractedComparator) {
|
|
119
|
-
return false
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const [
|
|
123
|
-
,
|
|
124
|
-
rangeOperator,
|
|
125
|
-
,
|
|
126
|
-
rangeMajor,
|
|
127
|
-
rangeMinor,
|
|
128
|
-
rangePatch,
|
|
129
|
-
rangePreRelease
|
|
130
|
-
] = extractedComparator
|
|
131
|
-
const rangeAtom: CompareAtom = {
|
|
132
|
-
operator: rangeOperator,
|
|
133
|
-
version: combineVersion(
|
|
134
|
-
rangeMajor,
|
|
135
|
-
rangeMinor,
|
|
136
|
-
rangePatch,
|
|
137
|
-
rangePreRelease
|
|
138
|
-
), // exclude build atom
|
|
139
|
-
major: rangeMajor,
|
|
140
|
-
minor: rangeMinor,
|
|
141
|
-
patch: rangePatch,
|
|
142
|
-
preRelease: rangePreRelease?.split('.')
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (!compare(rangeAtom, versionAtom)) {
|
|
146
|
-
return false // early return
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return true
|
|
151
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2022 Origin.js and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are licensed under Mulan PSL v2.
|
|
5
|
-
// You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
6
|
-
// You may obtain a copy of Mulan PSL v2 at:
|
|
7
|
-
// http://license.coscl.org.cn/MulanPSL2
|
|
8
|
-
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
9
|
-
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
10
|
-
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
11
|
-
// See the Mulan PSL v2 for more details.
|
|
12
|
-
//
|
|
13
|
-
// SPDX-License-Identifier: MulanPSL-2.0
|
|
14
|
-
// *****************************************************************************
|
|
15
|
-
|
|
16
|
-
import { comparator } from './constants'
|
|
17
|
-
|
|
18
|
-
export function parseRegex(source: string): RegExp {
|
|
19
|
-
return new RegExp(source)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function isXVersion(version: string): boolean {
|
|
23
|
-
return !version || version.toLowerCase() === 'x' || version === '*'
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function pipe<TArgs extends any[], R1, R2, R3, R4, R5, R6, R7>(
|
|
27
|
-
f1: (...args: TArgs) => R1,
|
|
28
|
-
f2: (a: R1) => R2,
|
|
29
|
-
f3: (a: R2) => R3,
|
|
30
|
-
f4: (a: R3) => R4,
|
|
31
|
-
f5: (a: R4) => R5,
|
|
32
|
-
f6: (a: R5) => R6,
|
|
33
|
-
f7: (a: R6) => R7
|
|
34
|
-
): (...args: TArgs) => R7
|
|
35
|
-
export function pipe<TArgs extends any[], R1, R2, R3, R4, R5, R6>(
|
|
36
|
-
f1: (...args: TArgs) => R1,
|
|
37
|
-
f2: (a: R1) => R2,
|
|
38
|
-
f3: (a: R2) => R3,
|
|
39
|
-
f4: (a: R3) => R4,
|
|
40
|
-
f5: (a: R4) => R5,
|
|
41
|
-
f6: (a: R5) => R6
|
|
42
|
-
): (...args: TArgs) => R6
|
|
43
|
-
export function pipe<TArgs extends any[], R1, R2, R3, R4, R5>(
|
|
44
|
-
f1: (...args: TArgs) => R1,
|
|
45
|
-
f2: (a: R1) => R2,
|
|
46
|
-
f3: (a: R2) => R3,
|
|
47
|
-
f4: (a: R3) => R4,
|
|
48
|
-
f5: (a: R4) => R5
|
|
49
|
-
): (...args: TArgs) => R5
|
|
50
|
-
export function pipe<TArgs extends any[], R1, R2, R3, R4>(
|
|
51
|
-
f1: (...args: TArgs) => R1,
|
|
52
|
-
f2: (a: R1) => R2,
|
|
53
|
-
f3: (a: R2) => R3,
|
|
54
|
-
f4: (a: R3) => R4
|
|
55
|
-
): (...args: TArgs) => R4
|
|
56
|
-
export function pipe<TArgs extends any[], R1, R2, R3>(
|
|
57
|
-
f1: (...args: TArgs) => R1,
|
|
58
|
-
f2: (a: R1) => R2,
|
|
59
|
-
f3: (a: R2) => R3
|
|
60
|
-
): (...args: TArgs) => R3
|
|
61
|
-
export function pipe<TArgs extends any[], R1, R2>(
|
|
62
|
-
f1: (...args: TArgs) => R1,
|
|
63
|
-
f2: (a: R1) => R2
|
|
64
|
-
): (...args: TArgs) => R2
|
|
65
|
-
export function pipe<TArgs extends any[], R1>(
|
|
66
|
-
f1: (...args: TArgs) => R1
|
|
67
|
-
): (...args: TArgs) => R1
|
|
68
|
-
export function pipe(...fns: ((params: any) => any)[]) {
|
|
69
|
-
return (x: unknown): any => {
|
|
70
|
-
return fns.reduce((v, f) => f(v), x)
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function extractComparator(
|
|
75
|
-
comparatorString: string
|
|
76
|
-
): RegExpMatchArray | null {
|
|
77
|
-
return comparatorString.match(parseRegex(comparator))
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export function combineVersion(
|
|
81
|
-
major: string,
|
|
82
|
-
minor: string,
|
|
83
|
-
patch: string,
|
|
84
|
-
preRelease: string
|
|
85
|
-
): string {
|
|
86
|
-
const mainVersion = `${major}.${minor}.${patch}`
|
|
87
|
-
|
|
88
|
-
if (preRelease) {
|
|
89
|
-
return `${mainVersion}-${preRelease}`
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return mainVersion
|
|
93
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2022 Origin.js and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are licensed under Mulan PSL v2.
|
|
5
|
-
// You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
6
|
-
// You may obtain a copy of Mulan PSL v2 at:
|
|
7
|
-
// http://license.coscl.org.cn/MulanPSL2
|
|
8
|
-
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
9
|
-
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
10
|
-
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
11
|
-
// See the Mulan PSL v2 for more details.
|
|
12
|
-
//
|
|
13
|
-
// SPDX-License-Identifier: MulanPSL-2.0
|
|
14
|
-
// *****************************************************************************
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Dynamic remote loader for runtime
|
|
18
|
-
* Provides utilities to dynamically load and manage remote components at runtime
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
export interface RemoteOptions {
|
|
22
|
-
url: string | (() => string | Promise<string>);
|
|
23
|
-
format?: 'esm' | 'systemjs' | 'var';
|
|
24
|
-
from?: 'vite' | 'webpack';
|
|
25
|
-
shareScope?: string;
|
|
26
|
-
external?: string | string[];
|
|
27
|
-
externalType?: 'url' | 'promise';
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface RemoteComponentConfig {
|
|
31
|
-
name: string;
|
|
32
|
-
component: string;
|
|
33
|
-
url: string | (() => string | Promise<string>);
|
|
34
|
-
options?: RemoteOptions;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Dynamic remote component manager
|
|
39
|
-
*/
|
|
40
|
-
export declare class DynamicRemoteManager {
|
|
41
|
-
private remoteCache: Map<string, any>;
|
|
42
|
-
private loadingPromises: Map<string, Promise<any>>;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Add a remote dynamically at runtime
|
|
46
|
-
* @param name Remote name
|
|
47
|
-
* @param config Remote configuration
|
|
48
|
-
*/
|
|
49
|
-
addRemote(name: string, config: RemoteOptions): Promise<void>;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Load a remote component dynamically
|
|
53
|
-
* @param remoteName Remote name
|
|
54
|
-
* @param componentName Component name to load from remote
|
|
55
|
-
* @returns Promise of the loaded component
|
|
56
|
-
*/
|
|
57
|
-
loadRemoteComponent(remoteName: string, componentName: string): Promise<any>;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Preload a remote component
|
|
61
|
-
* @param remoteName Remote name
|
|
62
|
-
* @param componentName Component name
|
|
63
|
-
*/
|
|
64
|
-
preloadRemoteComponent(remoteName: string, componentName: string): Promise<void>;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Remove a remote component from cache
|
|
68
|
-
* @param remoteName Remote name
|
|
69
|
-
* @param componentName Component name
|
|
70
|
-
*/
|
|
71
|
-
clearRemoteComponentCache(remoteName: string, componentName?: string): void;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Get all cached remote components
|
|
75
|
-
*/
|
|
76
|
-
getCachedRemotes(): string[];
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Check if a remote component is cached
|
|
80
|
-
* @param remoteName Remote name
|
|
81
|
-
* @param componentName Component name
|
|
82
|
-
*/
|
|
83
|
-
isRemoteComponentCached(remoteName: string, componentName: string): boolean;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Global instance
|
|
87
|
-
export declare const dynamicRemoteManager: DynamicRemoteManager;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Convenience function to dynamically load remote component
|
|
91
|
-
* @param config Remote component configuration
|
|
92
|
-
*/
|
|
93
|
-
export declare function loadDynamicRemoteComponent(config: RemoteComponentConfig): Promise<any>;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Vue 3 composable for dynamic remote loading
|
|
97
|
-
* @param remoteName Remote name
|
|
98
|
-
* @param componentName Component name
|
|
99
|
-
*/
|
|
100
|
-
export declare function useDynamicRemote(remoteName: string, componentName: string): {
|
|
101
|
-
component: any;
|
|
102
|
-
loading: any;
|
|
103
|
-
error: any;
|
|
104
|
-
reload: () => Promise<void>;
|
|
105
|
-
};
|