@obsfx/trekker 0.1.5 → 0.1.7
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/README.md +175 -0
- package/package.json +1 -1
- package/webapp-dist/.next/BUILD_ID +1 -1
- package/webapp-dist/.next/build-manifest.json +2 -2
- package/webapp-dist/.next/prerender-manifest.json +3 -3
- package/webapp-dist/.next/server/app/_global-error.html +2 -2
- package/webapp-dist/.next/server/app/_global-error.rsc +1 -1
- package/webapp-dist/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/webapp-dist/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/webapp-dist/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/webapp-dist/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/webapp-dist/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/webapp-dist/.next/server/app/_not-found.html +2 -2
- package/webapp-dist/.next/server/app/_not-found.rsc +1 -1
- package/webapp-dist/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/webapp-dist/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/webapp-dist/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/webapp-dist/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/webapp-dist/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/webapp-dist/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/webapp-dist/.next/server/app/index.html +2 -2
- package/webapp-dist/.next/server/app/index.rsc +1 -1
- package/webapp-dist/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/webapp-dist/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/webapp-dist/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/webapp-dist/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/webapp-dist/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/webapp-dist/.next/server/pages/404.html +2 -2
- package/webapp-dist/.next/server/pages/500.html +2 -2
- package/webapp-dist/.next/server/server-reference-manifest.js +1 -1
- package/webapp-dist/.next/server/server-reference-manifest.json +1 -1
- package/webapp-dist/node_modules/@next/env/dist/index.js +1 -0
- package/webapp-dist/node_modules/@next/env/package.json +36 -0
- package/webapp-dist/node_modules/buffer-from/index.js +72 -0
- package/webapp-dist/node_modules/buffer-from/package.json +19 -0
- package/webapp-dist/node_modules/client-only/index.js +0 -0
- package/webapp-dist/node_modules/client-only/package.json +19 -0
- package/webapp-dist/node_modules/detect-libc/lib/detect-libc.js +313 -0
- package/webapp-dist/node_modules/detect-libc/lib/elf.js +39 -0
- package/webapp-dist/node_modules/detect-libc/lib/filesystem.js +51 -0
- package/webapp-dist/node_modules/detect-libc/lib/process.js +24 -0
- package/webapp-dist/node_modules/detect-libc/package.json +44 -0
- package/webapp-dist/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js +10 -0
- package/webapp-dist/node_modules/react/cjs/react-jsx-runtime.production.min.js +11 -0
- package/webapp-dist/node_modules/react/cjs/react.production.min.js +26 -0
- package/webapp-dist/node_modules/react/index.js +7 -0
- package/webapp-dist/node_modules/react/jsx-dev-runtime.js +7 -0
- package/webapp-dist/node_modules/react/jsx-runtime.js +7 -0
- package/webapp-dist/node_modules/react/package.json +47 -0
- package/webapp-dist/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +93 -0
- package/webapp-dist/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.min.js +101 -0
- package/webapp-dist/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js +96 -0
- package/webapp-dist/node_modules/react-dom/cjs/react-dom-server.node.production.min.js +102 -0
- package/webapp-dist/node_modules/react-dom/cjs/react-dom.production.min.js +322 -0
- package/webapp-dist/node_modules/react-dom/index.js +38 -0
- package/webapp-dist/node_modules/react-dom/package.json +62 -0
- package/webapp-dist/node_modules/react-dom/server.browser.js +17 -0
- package/webapp-dist/node_modules/react-dom/server.node.js +17 -0
- package/webapp-dist/node_modules/scheduler/cjs/scheduler.development.js +634 -0
- package/webapp-dist/node_modules/scheduler/cjs/scheduler.production.min.js +19 -0
- package/webapp-dist/node_modules/scheduler/index.js +7 -0
- package/webapp-dist/node_modules/scheduler/package.json +36 -0
- package/webapp-dist/node_modules/semver/classes/comparator.js +143 -0
- package/webapp-dist/node_modules/semver/classes/range.js +557 -0
- package/webapp-dist/node_modules/semver/classes/semver.js +333 -0
- package/webapp-dist/node_modules/semver/functions/cmp.js +54 -0
- package/webapp-dist/node_modules/semver/functions/coerce.js +62 -0
- package/webapp-dist/node_modules/semver/functions/compare.js +7 -0
- package/webapp-dist/node_modules/semver/functions/eq.js +5 -0
- package/webapp-dist/node_modules/semver/functions/gt.js +5 -0
- package/webapp-dist/node_modules/semver/functions/gte.js +5 -0
- package/webapp-dist/node_modules/semver/functions/lt.js +5 -0
- package/webapp-dist/node_modules/semver/functions/lte.js +5 -0
- package/webapp-dist/node_modules/semver/functions/neq.js +5 -0
- package/webapp-dist/node_modules/semver/functions/parse.js +18 -0
- package/webapp-dist/node_modules/semver/functions/satisfies.js +12 -0
- package/webapp-dist/node_modules/semver/internal/constants.js +37 -0
- package/webapp-dist/node_modules/semver/internal/debug.js +11 -0
- package/webapp-dist/node_modules/semver/internal/identifiers.js +29 -0
- package/webapp-dist/node_modules/semver/internal/lrucache.js +42 -0
- package/webapp-dist/node_modules/semver/internal/parse-options.js +17 -0
- package/webapp-dist/node_modules/semver/internal/re.js +223 -0
- package/webapp-dist/node_modules/semver/package.json +78 -0
- package/webapp-dist/node_modules/sharp/lib/channel.js +177 -0
- package/webapp-dist/node_modules/sharp/lib/colour.js +195 -0
- package/webapp-dist/node_modules/sharp/lib/composite.js +212 -0
- package/webapp-dist/node_modules/sharp/lib/constructor.js +499 -0
- package/webapp-dist/node_modules/sharp/lib/index.js +16 -0
- package/webapp-dist/node_modules/sharp/lib/input.js +809 -0
- package/webapp-dist/node_modules/sharp/lib/is.js +143 -0
- package/webapp-dist/node_modules/sharp/lib/libvips.js +207 -0
- package/webapp-dist/node_modules/sharp/lib/operation.js +1016 -0
- package/webapp-dist/node_modules/sharp/lib/output.js +1666 -0
- package/webapp-dist/node_modules/sharp/lib/resize.js +595 -0
- package/webapp-dist/node_modules/sharp/lib/sharp.js +121 -0
- package/webapp-dist/node_modules/sharp/lib/utility.js +291 -0
- package/webapp-dist/node_modules/sharp/package.json +202 -0
- package/webapp-dist/node_modules/source-map/lib/array-set.js +121 -0
- package/webapp-dist/node_modules/source-map/lib/base64-vlq.js +140 -0
- package/webapp-dist/node_modules/source-map/lib/base64.js +67 -0
- package/webapp-dist/node_modules/source-map/lib/binary-search.js +111 -0
- package/webapp-dist/node_modules/source-map/lib/mapping-list.js +79 -0
- package/webapp-dist/node_modules/source-map/lib/quick-sort.js +114 -0
- package/webapp-dist/node_modules/source-map/lib/source-map-consumer.js +1145 -0
- package/webapp-dist/node_modules/source-map/lib/source-map-generator.js +425 -0
- package/webapp-dist/node_modules/source-map/lib/source-node.js +413 -0
- package/webapp-dist/node_modules/source-map/lib/util.js +488 -0
- package/webapp-dist/node_modules/source-map/package.json +73 -0
- package/webapp-dist/node_modules/source-map/source-map.js +8 -0
- package/webapp-dist/node_modules/source-map-support/LICENSE.md +21 -0
- package/webapp-dist/node_modules/source-map-support/README.md +284 -0
- package/webapp-dist/node_modules/source-map-support/browser-source-map-support.js +114 -0
- package/webapp-dist/node_modules/source-map-support/package.json +31 -0
- package/webapp-dist/node_modules/source-map-support/register-hook-require.js +1 -0
- package/webapp-dist/node_modules/source-map-support/register.js +1 -0
- package/webapp-dist/node_modules/source-map-support/source-map-support.js +625 -0
- package/webapp-dist/node_modules/styled-jsx/dist/index/index.js +499 -0
- package/webapp-dist/node_modules/styled-jsx/index.js +1 -0
- package/webapp-dist/node_modules/styled-jsx/package.json +132 -0
- package/webapp-dist/node_modules/styled-jsx/style.js +1 -0
- package/webapp-dist/node_modules/typescript/lib/_tsc.js +133818 -0
- package/webapp-dist/node_modules/typescript/lib/_tsserver.js +659 -0
- package/webapp-dist/node_modules/typescript/lib/_typingsInstaller.js +222 -0
- package/webapp-dist/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
- package/webapp-dist/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
- package/webapp-dist/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
- package/webapp-dist/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
- package/webapp-dist/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
- package/webapp-dist/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
- package/webapp-dist/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
- package/webapp-dist/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
- package/webapp-dist/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
- package/webapp-dist/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
- package/webapp-dist/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
- package/webapp-dist/node_modules/typescript/lib/tsc.js +8 -0
- package/webapp-dist/node_modules/typescript/lib/tsserver.js +8 -0
- package/webapp-dist/node_modules/typescript/lib/tsserverlibrary.js +21 -0
- package/webapp-dist/node_modules/typescript/lib/typesMap.json +497 -0
- package/webapp-dist/node_modules/typescript/lib/typescript.js +200276 -0
- package/webapp-dist/node_modules/typescript/lib/typingsInstaller.js +8 -0
- package/webapp-dist/node_modules/typescript/lib/watchGuard.js +53 -0
- package/webapp-dist/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
- package/webapp-dist/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
- package/webapp-dist/node_modules/typescript/package.json +120 -0
- /package/webapp-dist/.next/static/{sziMhYzomTi_mBUq2dVcq → 6d9vQZJNWnbBaVrpBo9kx}/_buildManifest.js +0 -0
- /package/webapp-dist/.next/static/{sziMhYzomTi_mBUq2dVcq → 6d9vQZJNWnbBaVrpBo9kx}/_clientMiddlewareManifest.json +0 -0
- /package/webapp-dist/.next/static/{sziMhYzomTi_mBUq2dVcq → 6d9vQZJNWnbBaVrpBo9kx}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
5
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
6
|
+
MAX_LENGTH,
|
|
7
|
+
} = require('./constants')
|
|
8
|
+
const debug = require('./debug')
|
|
9
|
+
exports = module.exports = {}
|
|
10
|
+
|
|
11
|
+
// The actual regexps go on exports.re
|
|
12
|
+
const re = exports.re = []
|
|
13
|
+
const safeRe = exports.safeRe = []
|
|
14
|
+
const src = exports.src = []
|
|
15
|
+
const safeSrc = exports.safeSrc = []
|
|
16
|
+
const t = exports.t = {}
|
|
17
|
+
let R = 0
|
|
18
|
+
|
|
19
|
+
const LETTERDASHNUMBER = '[a-zA-Z0-9-]'
|
|
20
|
+
|
|
21
|
+
// Replace some greedy regex tokens to prevent regex dos issues. These regex are
|
|
22
|
+
// used internally via the safeRe object since all inputs in this library get
|
|
23
|
+
// normalized first to trim and collapse all extra whitespace. The original
|
|
24
|
+
// regexes are exported for userland consumption and lower level usage. A
|
|
25
|
+
// future breaking change could export the safer regex only with a note that
|
|
26
|
+
// all input should have extra whitespace removed.
|
|
27
|
+
const safeRegexReplacements = [
|
|
28
|
+
['\\s', 1],
|
|
29
|
+
['\\d', MAX_LENGTH],
|
|
30
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
const makeSafeRegex = (value) => {
|
|
34
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
35
|
+
value = value
|
|
36
|
+
.split(`${token}*`).join(`${token}{0,${max}}`)
|
|
37
|
+
.split(`${token}+`).join(`${token}{1,${max}}`)
|
|
38
|
+
}
|
|
39
|
+
return value
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const createToken = (name, value, isGlobal) => {
|
|
43
|
+
const safe = makeSafeRegex(value)
|
|
44
|
+
const index = R++
|
|
45
|
+
debug(name, index, value)
|
|
46
|
+
t[name] = index
|
|
47
|
+
src[index] = value
|
|
48
|
+
safeSrc[index] = safe
|
|
49
|
+
re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
|
|
50
|
+
safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// The following Regular Expressions can be used for tokenizing,
|
|
54
|
+
// validating, and parsing SemVer version strings.
|
|
55
|
+
|
|
56
|
+
// ## Numeric Identifier
|
|
57
|
+
// A single `0`, or a non-zero digit followed by zero or more digits.
|
|
58
|
+
|
|
59
|
+
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
|
|
60
|
+
createToken('NUMERICIDENTIFIERLOOSE', '\\d+')
|
|
61
|
+
|
|
62
|
+
// ## Non-numeric Identifier
|
|
63
|
+
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
|
64
|
+
// more letters, digits, or hyphens.
|
|
65
|
+
|
|
66
|
+
createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)
|
|
67
|
+
|
|
68
|
+
// ## Main Version
|
|
69
|
+
// Three dot-separated numeric identifiers.
|
|
70
|
+
|
|
71
|
+
createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
|
|
72
|
+
`(${src[t.NUMERICIDENTIFIER]})\\.` +
|
|
73
|
+
`(${src[t.NUMERICIDENTIFIER]})`)
|
|
74
|
+
|
|
75
|
+
createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
|
76
|
+
`(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
|
77
|
+
`(${src[t.NUMERICIDENTIFIERLOOSE]})`)
|
|
78
|
+
|
|
79
|
+
// ## Pre-release Version Identifier
|
|
80
|
+
// A numeric identifier, or a non-numeric identifier.
|
|
81
|
+
// Non-numberic identifiers include numberic identifiers but can be longer.
|
|
82
|
+
// Therefore non-numberic identifiers must go first.
|
|
83
|
+
|
|
84
|
+
createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]
|
|
85
|
+
}|${src[t.NUMERICIDENTIFIER]})`)
|
|
86
|
+
|
|
87
|
+
createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]
|
|
88
|
+
}|${src[t.NUMERICIDENTIFIERLOOSE]})`)
|
|
89
|
+
|
|
90
|
+
// ## Pre-release Version
|
|
91
|
+
// Hyphen, followed by one or more dot-separated pre-release version
|
|
92
|
+
// identifiers.
|
|
93
|
+
|
|
94
|
+
createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
|
|
95
|
+
}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
|
|
96
|
+
|
|
97
|
+
createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
|
|
98
|
+
}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
|
|
99
|
+
|
|
100
|
+
// ## Build Metadata Identifier
|
|
101
|
+
// Any combination of digits, letters, or hyphens.
|
|
102
|
+
|
|
103
|
+
createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)
|
|
104
|
+
|
|
105
|
+
// ## Build Metadata
|
|
106
|
+
// Plus sign, followed by one or more period-separated build metadata
|
|
107
|
+
// identifiers.
|
|
108
|
+
|
|
109
|
+
createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
|
|
110
|
+
}(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
|
|
111
|
+
|
|
112
|
+
// ## Full Version String
|
|
113
|
+
// A main version, followed optionally by a pre-release version and
|
|
114
|
+
// build metadata.
|
|
115
|
+
|
|
116
|
+
// Note that the only major, minor, patch, and pre-release sections of
|
|
117
|
+
// the version string are capturing groups. The build metadata is not a
|
|
118
|
+
// capturing group, because it should not ever be used in version
|
|
119
|
+
// comparison.
|
|
120
|
+
|
|
121
|
+
createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
|
|
122
|
+
}${src[t.PRERELEASE]}?${
|
|
123
|
+
src[t.BUILD]}?`)
|
|
124
|
+
|
|
125
|
+
createToken('FULL', `^${src[t.FULLPLAIN]}$`)
|
|
126
|
+
|
|
127
|
+
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
|
128
|
+
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
|
129
|
+
// common in the npm registry.
|
|
130
|
+
createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
|
|
131
|
+
}${src[t.PRERELEASELOOSE]}?${
|
|
132
|
+
src[t.BUILD]}?`)
|
|
133
|
+
|
|
134
|
+
createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
|
|
135
|
+
|
|
136
|
+
createToken('GTLT', '((?:<|>)?=?)')
|
|
137
|
+
|
|
138
|
+
// Something like "2.*" or "1.2.x".
|
|
139
|
+
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
|
140
|
+
// Only the first item is strictly required.
|
|
141
|
+
createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
|
|
142
|
+
createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
|
|
143
|
+
|
|
144
|
+
createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
|
|
145
|
+
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
|
146
|
+
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
|
147
|
+
`(?:${src[t.PRERELEASE]})?${
|
|
148
|
+
src[t.BUILD]}?` +
|
|
149
|
+
`)?)?`)
|
|
150
|
+
|
|
151
|
+
createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
|
152
|
+
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
|
153
|
+
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
|
154
|
+
`(?:${src[t.PRERELEASELOOSE]})?${
|
|
155
|
+
src[t.BUILD]}?` +
|
|
156
|
+
`)?)?`)
|
|
157
|
+
|
|
158
|
+
createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
|
|
159
|
+
createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
|
|
160
|
+
|
|
161
|
+
// Coercion.
|
|
162
|
+
// Extract anything that could conceivably be a part of a valid semver
|
|
163
|
+
createToken('COERCEPLAIN', `${'(^|[^\\d])' +
|
|
164
|
+
'(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
|
|
165
|
+
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
|
|
166
|
+
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)
|
|
167
|
+
createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`)
|
|
168
|
+
createToken('COERCEFULL', src[t.COERCEPLAIN] +
|
|
169
|
+
`(?:${src[t.PRERELEASE]})?` +
|
|
170
|
+
`(?:${src[t.BUILD]})?` +
|
|
171
|
+
`(?:$|[^\\d])`)
|
|
172
|
+
createToken('COERCERTL', src[t.COERCE], true)
|
|
173
|
+
createToken('COERCERTLFULL', src[t.COERCEFULL], true)
|
|
174
|
+
|
|
175
|
+
// Tilde ranges.
|
|
176
|
+
// Meaning is "reasonably at or greater than"
|
|
177
|
+
createToken('LONETILDE', '(?:~>?)')
|
|
178
|
+
|
|
179
|
+
createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
|
|
180
|
+
exports.tildeTrimReplace = '$1~'
|
|
181
|
+
|
|
182
|
+
createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
|
|
183
|
+
createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
|
|
184
|
+
|
|
185
|
+
// Caret ranges.
|
|
186
|
+
// Meaning is "at least and backwards compatible with"
|
|
187
|
+
createToken('LONECARET', '(?:\\^)')
|
|
188
|
+
|
|
189
|
+
createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
|
|
190
|
+
exports.caretTrimReplace = '$1^'
|
|
191
|
+
|
|
192
|
+
createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
|
|
193
|
+
createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
|
|
194
|
+
|
|
195
|
+
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
|
196
|
+
createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
|
|
197
|
+
createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
|
|
198
|
+
|
|
199
|
+
// An expression to strip any whitespace between the gtlt and the thing
|
|
200
|
+
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
|
201
|
+
createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
|
|
202
|
+
}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
|
|
203
|
+
exports.comparatorTrimReplace = '$1$2$3'
|
|
204
|
+
|
|
205
|
+
// Something like `1.2.3 - 1.2.4`
|
|
206
|
+
// Note that these all use the loose form, because they'll be
|
|
207
|
+
// checked against either the strict or loose comparator form
|
|
208
|
+
// later.
|
|
209
|
+
createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
|
|
210
|
+
`\\s+-\\s+` +
|
|
211
|
+
`(${src[t.XRANGEPLAIN]})` +
|
|
212
|
+
`\\s*$`)
|
|
213
|
+
|
|
214
|
+
createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
|
|
215
|
+
`\\s+-\\s+` +
|
|
216
|
+
`(${src[t.XRANGEPLAINLOOSE]})` +
|
|
217
|
+
`\\s*$`)
|
|
218
|
+
|
|
219
|
+
// Star ranges basically just allow anything at all.
|
|
220
|
+
createToken('STAR', '(<|>)?=?\\s*\\*')
|
|
221
|
+
// >=0.0.0 is like a star
|
|
222
|
+
createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$')
|
|
223
|
+
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$')
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "semver",
|
|
3
|
+
"version": "7.7.3",
|
|
4
|
+
"description": "The semantic version parser used by npm.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "tap",
|
|
8
|
+
"snap": "tap",
|
|
9
|
+
"lint": "npm run eslint",
|
|
10
|
+
"postlint": "template-oss-check",
|
|
11
|
+
"lintfix": "npm run eslint -- --fix",
|
|
12
|
+
"posttest": "npm run lint",
|
|
13
|
+
"template-oss-apply": "template-oss-apply --force",
|
|
14
|
+
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@npmcli/eslint-config": "^5.0.0",
|
|
18
|
+
"@npmcli/template-oss": "4.25.1",
|
|
19
|
+
"benchmark": "^2.1.4",
|
|
20
|
+
"tap": "^16.0.0"
|
|
21
|
+
},
|
|
22
|
+
"license": "ISC",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/npm/node-semver.git"
|
|
26
|
+
},
|
|
27
|
+
"bin": {
|
|
28
|
+
"semver": "bin/semver.js"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"bin/",
|
|
32
|
+
"lib/",
|
|
33
|
+
"classes/",
|
|
34
|
+
"functions/",
|
|
35
|
+
"internal/",
|
|
36
|
+
"ranges/",
|
|
37
|
+
"index.js",
|
|
38
|
+
"preload.js",
|
|
39
|
+
"range.bnf"
|
|
40
|
+
],
|
|
41
|
+
"tap": {
|
|
42
|
+
"timeout": 30,
|
|
43
|
+
"coverage-map": "map.js",
|
|
44
|
+
"nyc-arg": [
|
|
45
|
+
"--exclude",
|
|
46
|
+
"tap-snapshots/**"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=10"
|
|
51
|
+
},
|
|
52
|
+
"author": "GitHub Inc.",
|
|
53
|
+
"templateOSS": {
|
|
54
|
+
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
|
55
|
+
"version": "4.25.1",
|
|
56
|
+
"engines": ">=10",
|
|
57
|
+
"distPaths": [
|
|
58
|
+
"classes/",
|
|
59
|
+
"functions/",
|
|
60
|
+
"internal/",
|
|
61
|
+
"ranges/",
|
|
62
|
+
"index.js",
|
|
63
|
+
"preload.js",
|
|
64
|
+
"range.bnf"
|
|
65
|
+
],
|
|
66
|
+
"allowPaths": [
|
|
67
|
+
"/classes/",
|
|
68
|
+
"/functions/",
|
|
69
|
+
"/internal/",
|
|
70
|
+
"/ranges/",
|
|
71
|
+
"/index.js",
|
|
72
|
+
"/preload.js",
|
|
73
|
+
"/range.bnf",
|
|
74
|
+
"/benchmarks"
|
|
75
|
+
],
|
|
76
|
+
"publish": "true"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
Copyright 2013 Lovell Fuller and others.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const is = require('./is');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Boolean operations for bandbool.
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
const bool = {
|
|
13
|
+
and: 'and',
|
|
14
|
+
or: 'or',
|
|
15
|
+
eor: 'eor'
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Remove alpha channels, if any. This is a no-op if the image does not have an alpha channel.
|
|
20
|
+
*
|
|
21
|
+
* See also {@link /api-operation/#flatten flatten}.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* sharp('rgba.png')
|
|
25
|
+
* .removeAlpha()
|
|
26
|
+
* .toFile('rgb.png', function(err, info) {
|
|
27
|
+
* // rgb.png is a 3 channel image without an alpha channel
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* @returns {Sharp}
|
|
31
|
+
*/
|
|
32
|
+
function removeAlpha () {
|
|
33
|
+
this.options.removeAlpha = true;
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Ensure the output image has an alpha transparency channel.
|
|
39
|
+
* If missing, the added alpha channel will have the specified
|
|
40
|
+
* transparency level, defaulting to fully-opaque (1).
|
|
41
|
+
* This is a no-op if the image already has an alpha channel.
|
|
42
|
+
*
|
|
43
|
+
* @since 0.21.2
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* // rgba.png will be a 4 channel image with a fully-opaque alpha channel
|
|
47
|
+
* await sharp('rgb.jpg')
|
|
48
|
+
* .ensureAlpha()
|
|
49
|
+
* .toFile('rgba.png')
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* // rgba is a 4 channel image with a fully-transparent alpha channel
|
|
53
|
+
* const rgba = await sharp(rgb)
|
|
54
|
+
* .ensureAlpha(0)
|
|
55
|
+
* .toBuffer();
|
|
56
|
+
*
|
|
57
|
+
* @param {number} [alpha=1] - alpha transparency level (0=fully-transparent, 1=fully-opaque)
|
|
58
|
+
* @returns {Sharp}
|
|
59
|
+
* @throws {Error} Invalid alpha transparency level
|
|
60
|
+
*/
|
|
61
|
+
function ensureAlpha (alpha) {
|
|
62
|
+
if (is.defined(alpha)) {
|
|
63
|
+
if (is.number(alpha) && is.inRange(alpha, 0, 1)) {
|
|
64
|
+
this.options.ensureAlpha = alpha;
|
|
65
|
+
} else {
|
|
66
|
+
throw is.invalidParameterError('alpha', 'number between 0 and 1', alpha);
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
this.options.ensureAlpha = 1;
|
|
70
|
+
}
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Extract a single channel from a multi-channel image.
|
|
76
|
+
*
|
|
77
|
+
* The output colourspace will be either `b-w` (8-bit) or `grey16` (16-bit).
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* // green.jpg is a greyscale image containing the green channel of the input
|
|
81
|
+
* await sharp(input)
|
|
82
|
+
* .extractChannel('green')
|
|
83
|
+
* .toFile('green.jpg');
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* // red1 is the red value of the first pixel, red2 the second pixel etc.
|
|
87
|
+
* const [red1, red2, ...] = await sharp(input)
|
|
88
|
+
* .extractChannel(0)
|
|
89
|
+
* .raw()
|
|
90
|
+
* .toBuffer();
|
|
91
|
+
*
|
|
92
|
+
* @param {number|string} channel - zero-indexed channel/band number to extract, or `red`, `green`, `blue` or `alpha`.
|
|
93
|
+
* @returns {Sharp}
|
|
94
|
+
* @throws {Error} Invalid channel
|
|
95
|
+
*/
|
|
96
|
+
function extractChannel (channel) {
|
|
97
|
+
const channelMap = { red: 0, green: 1, blue: 2, alpha: 3 };
|
|
98
|
+
if (Object.keys(channelMap).includes(channel)) {
|
|
99
|
+
channel = channelMap[channel];
|
|
100
|
+
}
|
|
101
|
+
if (is.integer(channel) && is.inRange(channel, 0, 4)) {
|
|
102
|
+
this.options.extractChannel = channel;
|
|
103
|
+
} else {
|
|
104
|
+
throw is.invalidParameterError('channel', 'integer or one of: red, green, blue, alpha', channel);
|
|
105
|
+
}
|
|
106
|
+
return this;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Join one or more channels to the image.
|
|
111
|
+
* The meaning of the added channels depends on the output colourspace, set with `toColourspace()`.
|
|
112
|
+
* By default the output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
|
|
113
|
+
* Channel ordering follows vips convention:
|
|
114
|
+
* - sRGB: 0: Red, 1: Green, 2: Blue, 3: Alpha.
|
|
115
|
+
* - CMYK: 0: Magenta, 1: Cyan, 2: Yellow, 3: Black, 4: Alpha.
|
|
116
|
+
*
|
|
117
|
+
* Buffers may be any of the image formats supported by sharp.
|
|
118
|
+
* For raw pixel input, the `options` object should contain a `raw` attribute, which follows the format of the attribute of the same name in the `sharp()` constructor.
|
|
119
|
+
*
|
|
120
|
+
* @param {Array<string|Buffer>|string|Buffer} images - one or more images (file paths, Buffers).
|
|
121
|
+
* @param {Object} options - image options, see `sharp()` constructor.
|
|
122
|
+
* @returns {Sharp}
|
|
123
|
+
* @throws {Error} Invalid parameters
|
|
124
|
+
*/
|
|
125
|
+
function joinChannel (images, options) {
|
|
126
|
+
if (Array.isArray(images)) {
|
|
127
|
+
images.forEach(function (image) {
|
|
128
|
+
this.options.joinChannelIn.push(this._createInputDescriptor(image, options));
|
|
129
|
+
}, this);
|
|
130
|
+
} else {
|
|
131
|
+
this.options.joinChannelIn.push(this._createInputDescriptor(images, options));
|
|
132
|
+
}
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* sharp('3-channel-rgb-input.png')
|
|
141
|
+
* .bandbool(sharp.bool.and)
|
|
142
|
+
* .toFile('1-channel-output.png', function (err, info) {
|
|
143
|
+
* // The output will be a single channel image where each pixel `P = R & G & B`.
|
|
144
|
+
* // If `I(1,1) = [247, 170, 14] = [0b11110111, 0b10101010, 0b00001111]`
|
|
145
|
+
* // then `O(1,1) = 0b11110111 & 0b10101010 & 0b00001111 = 0b00000010 = 2`.
|
|
146
|
+
* });
|
|
147
|
+
*
|
|
148
|
+
* @param {string} boolOp - one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
|
|
149
|
+
* @returns {Sharp}
|
|
150
|
+
* @throws {Error} Invalid parameters
|
|
151
|
+
*/
|
|
152
|
+
function bandbool (boolOp) {
|
|
153
|
+
if (is.string(boolOp) && is.inArray(boolOp, ['and', 'or', 'eor'])) {
|
|
154
|
+
this.options.bandBoolOp = boolOp;
|
|
155
|
+
} else {
|
|
156
|
+
throw is.invalidParameterError('boolOp', 'one of: and, or, eor', boolOp);
|
|
157
|
+
}
|
|
158
|
+
return this;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Decorate the Sharp prototype with channel-related functions.
|
|
163
|
+
* @module Sharp
|
|
164
|
+
* @private
|
|
165
|
+
*/
|
|
166
|
+
module.exports = (Sharp) => {
|
|
167
|
+
Object.assign(Sharp.prototype, {
|
|
168
|
+
// Public instance functions
|
|
169
|
+
removeAlpha,
|
|
170
|
+
ensureAlpha,
|
|
171
|
+
extractChannel,
|
|
172
|
+
joinChannel,
|
|
173
|
+
bandbool
|
|
174
|
+
});
|
|
175
|
+
// Class attributes
|
|
176
|
+
Sharp.bool = bool;
|
|
177
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
Copyright 2013 Lovell Fuller and others.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const color = require('@img/colour');
|
|
7
|
+
const is = require('./is');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Colourspaces.
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
13
|
+
const colourspace = {
|
|
14
|
+
multiband: 'multiband',
|
|
15
|
+
'b-w': 'b-w',
|
|
16
|
+
bw: 'b-w',
|
|
17
|
+
cmyk: 'cmyk',
|
|
18
|
+
srgb: 'srgb'
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Tint the image using the provided colour.
|
|
23
|
+
* An alpha channel may be present and will be unchanged by the operation.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const output = await sharp(input)
|
|
27
|
+
* .tint({ r: 255, g: 240, b: 16 })
|
|
28
|
+
* .toBuffer();
|
|
29
|
+
*
|
|
30
|
+
* @param {string|Object} tint - Parsed by the [color](https://www.npmjs.org/package/color) module.
|
|
31
|
+
* @returns {Sharp}
|
|
32
|
+
* @throws {Error} Invalid parameter
|
|
33
|
+
*/
|
|
34
|
+
function tint (tint) {
|
|
35
|
+
this._setBackgroundColourOption('tint', tint);
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Convert to 8-bit greyscale; 256 shades of grey.
|
|
41
|
+
* This is a linear operation. If the input image is in a non-linear colour space such as sRGB, use `gamma()` with `greyscale()` for the best results.
|
|
42
|
+
* By default the output image will be web-friendly sRGB and contain three (identical) colour channels.
|
|
43
|
+
* This may be overridden by other sharp operations such as `toColourspace('b-w')`,
|
|
44
|
+
* which will produce an output image containing one colour channel.
|
|
45
|
+
* An alpha channel may be present, and will be unchanged by the operation.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* const output = await sharp(input).greyscale().toBuffer();
|
|
49
|
+
*
|
|
50
|
+
* @param {Boolean} [greyscale=true]
|
|
51
|
+
* @returns {Sharp}
|
|
52
|
+
*/
|
|
53
|
+
function greyscale (greyscale) {
|
|
54
|
+
this.options.greyscale = is.bool(greyscale) ? greyscale : true;
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Alternative spelling of `greyscale`.
|
|
60
|
+
* @param {Boolean} [grayscale=true]
|
|
61
|
+
* @returns {Sharp}
|
|
62
|
+
*/
|
|
63
|
+
function grayscale (grayscale) {
|
|
64
|
+
return this.greyscale(grayscale);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Set the pipeline colourspace.
|
|
69
|
+
*
|
|
70
|
+
* The input image will be converted to the provided colourspace at the start of the pipeline.
|
|
71
|
+
* All operations will use this colourspace before converting to the output colourspace,
|
|
72
|
+
* as defined by {@link #tocolourspace toColourspace}.
|
|
73
|
+
*
|
|
74
|
+
* @since 0.29.0
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* // Run pipeline in 16 bits per channel RGB while converting final result to 8 bits per channel sRGB.
|
|
78
|
+
* await sharp(input)
|
|
79
|
+
* .pipelineColourspace('rgb16')
|
|
80
|
+
* .toColourspace('srgb')
|
|
81
|
+
* .toFile('16bpc-pipeline-to-8bpc-output.png')
|
|
82
|
+
*
|
|
83
|
+
* @param {string} [colourspace] - pipeline colourspace e.g. `rgb16`, `scrgb`, `lab`, `grey16` [...](https://www.libvips.org/API/current/enum.Interpretation.html)
|
|
84
|
+
* @returns {Sharp}
|
|
85
|
+
* @throws {Error} Invalid parameters
|
|
86
|
+
*/
|
|
87
|
+
function pipelineColourspace (colourspace) {
|
|
88
|
+
if (!is.string(colourspace)) {
|
|
89
|
+
throw is.invalidParameterError('colourspace', 'string', colourspace);
|
|
90
|
+
}
|
|
91
|
+
this.options.colourspacePipeline = colourspace;
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Alternative spelling of `pipelineColourspace`.
|
|
97
|
+
* @param {string} [colorspace] - pipeline colorspace.
|
|
98
|
+
* @returns {Sharp}
|
|
99
|
+
* @throws {Error} Invalid parameters
|
|
100
|
+
*/
|
|
101
|
+
function pipelineColorspace (colorspace) {
|
|
102
|
+
return this.pipelineColourspace(colorspace);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Set the output colourspace.
|
|
107
|
+
* By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* // Output 16 bits per pixel RGB
|
|
111
|
+
* await sharp(input)
|
|
112
|
+
* .toColourspace('rgb16')
|
|
113
|
+
* .toFile('16-bpp.png')
|
|
114
|
+
*
|
|
115
|
+
* @param {string} [colourspace] - output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://www.libvips.org/API/current/enum.Interpretation.html)
|
|
116
|
+
* @returns {Sharp}
|
|
117
|
+
* @throws {Error} Invalid parameters
|
|
118
|
+
*/
|
|
119
|
+
function toColourspace (colourspace) {
|
|
120
|
+
if (!is.string(colourspace)) {
|
|
121
|
+
throw is.invalidParameterError('colourspace', 'string', colourspace);
|
|
122
|
+
}
|
|
123
|
+
this.options.colourspace = colourspace;
|
|
124
|
+
return this;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Alternative spelling of `toColourspace`.
|
|
129
|
+
* @param {string} [colorspace] - output colorspace.
|
|
130
|
+
* @returns {Sharp}
|
|
131
|
+
* @throws {Error} Invalid parameters
|
|
132
|
+
*/
|
|
133
|
+
function toColorspace (colorspace) {
|
|
134
|
+
return this.toColourspace(colorspace);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Create a RGBA colour array from a given value.
|
|
139
|
+
* @private
|
|
140
|
+
* @param {string|Object} value
|
|
141
|
+
* @throws {Error} Invalid value
|
|
142
|
+
*/
|
|
143
|
+
function _getBackgroundColourOption (value) {
|
|
144
|
+
if (
|
|
145
|
+
is.object(value) ||
|
|
146
|
+
(is.string(value) && value.length >= 3 && value.length <= 200)
|
|
147
|
+
) {
|
|
148
|
+
const colour = color(value);
|
|
149
|
+
return [
|
|
150
|
+
colour.red(),
|
|
151
|
+
colour.green(),
|
|
152
|
+
colour.blue(),
|
|
153
|
+
Math.round(colour.alpha() * 255)
|
|
154
|
+
];
|
|
155
|
+
} else {
|
|
156
|
+
throw is.invalidParameterError('background', 'object or string', value);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Update a colour attribute of the this.options Object.
|
|
162
|
+
* @private
|
|
163
|
+
* @param {string} key
|
|
164
|
+
* @param {string|Object} value
|
|
165
|
+
* @throws {Error} Invalid value
|
|
166
|
+
*/
|
|
167
|
+
function _setBackgroundColourOption (key, value) {
|
|
168
|
+
if (is.defined(value)) {
|
|
169
|
+
this.options[key] = _getBackgroundColourOption(value);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Decorate the Sharp prototype with colour-related functions.
|
|
175
|
+
* @module Sharp
|
|
176
|
+
* @private
|
|
177
|
+
*/
|
|
178
|
+
module.exports = (Sharp) => {
|
|
179
|
+
Object.assign(Sharp.prototype, {
|
|
180
|
+
// Public
|
|
181
|
+
tint,
|
|
182
|
+
greyscale,
|
|
183
|
+
grayscale,
|
|
184
|
+
pipelineColourspace,
|
|
185
|
+
pipelineColorspace,
|
|
186
|
+
toColourspace,
|
|
187
|
+
toColorspace,
|
|
188
|
+
// Private
|
|
189
|
+
_getBackgroundColourOption,
|
|
190
|
+
_setBackgroundColourOption
|
|
191
|
+
});
|
|
192
|
+
// Class attributes
|
|
193
|
+
Sharp.colourspace = colourspace;
|
|
194
|
+
Sharp.colorspace = colourspace;
|
|
195
|
+
};
|