@quazardous/qdadm 2.14.0 → 2.16.0
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 +1 -0
- package/package.json +7 -5
- package/src/chain/index.ts +5 -0
- package/src/composables/useEntityItemShowPage.ts +8 -0
- package/src/composables/useListPage.ts +23 -0
- package/src/composables/useListPage.types.ts +3 -0
- package/src/composables/useLiveEntity.ts +115 -0
- package/src/deferred/index.ts +5 -0
- package/src/entity/EntityManager.cache.ts +20 -0
- package/src/entity/EntityManager.interface.ts +3 -0
- package/src/entity/EntityManager.ts +29 -1
- package/src/entity/EntityManager.types.ts +32 -0
- package/src/gen/vite-plugin.ts +4 -0
- package/src/i18n/I18n.ts +25 -1
- package/src/i18n/__tests__/I18n.missingCap.test.ts +82 -0
- package/src/index.ts +10 -0
- package/src/kernel/Kernel.registries.ts +31 -5
- package/src/kernel/Kernel.ts +3 -0
- package/src/kernel/Kernel.types.ts +31 -0
- package/src/kernel/LiveEntityRouter.ts +189 -0
- package/src/kernel/SSEBridge.ts +3 -0
- package/src/query/index.ts +7 -0
- package/src/types/index.ts +2 -0
- package/src/utils/pluralize.ts +472 -0
- package/src/vite/qdadmPlugin.ts +5 -19
- package/src/vite-env.d.ts +0 -16
- package/src/generated/managers/testManager.js +0 -45
- package/src/types/pluralize.d.ts +0 -19
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vendored ESM port of `pluralize@8.0.0` (#1454).
|
|
3
|
+
*
|
|
4
|
+
* qdadm ships raw TS sources; `pluralize` was our only CJS dependency and
|
|
5
|
+
* forced the whole `optimizeDeps.include` machinery in qdadmVitePlugin —
|
|
6
|
+
* which still broke for file:-linked consumers (npm install-links=false)
|
|
7
|
+
* where the dep is never installed at the consumer root. Vendoring removes
|
|
8
|
+
* the dependency class entirely. Rules/irregulars tables are verbatim.
|
|
9
|
+
*
|
|
10
|
+
* Original: https://github.com/plurals/pluralize
|
|
11
|
+
*
|
|
12
|
+
* The MIT License (MIT)
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) 2013 Blake Embrey (hello@blakeembrey.com)
|
|
15
|
+
*
|
|
16
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
17
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
18
|
+
* in the Software without restriction, including without limitation the rights
|
|
19
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
20
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
21
|
+
* furnished to do so, subject to the following conditions:
|
|
22
|
+
*
|
|
23
|
+
* The above copyright notice and this permission notice shall be included in
|
|
24
|
+
* all copies or substantial portions of the Software.
|
|
25
|
+
*
|
|
26
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
27
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
28
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
29
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
30
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
31
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
32
|
+
* THE SOFTWARE.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
type Rule = [RegExp, string]
|
|
36
|
+
|
|
37
|
+
// Rule storage - pluralize and singularize need to be run sequentially,
|
|
38
|
+
// while other rules can be optimized using an object for instant lookups.
|
|
39
|
+
const pluralRules: Rule[] = []
|
|
40
|
+
const singularRules: Rule[] = []
|
|
41
|
+
const uncountables: Record<string, boolean> = {}
|
|
42
|
+
const irregularPlurals: Record<string, string> = {}
|
|
43
|
+
const irregularSingles: Record<string, string> = {}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Sanitize a pluralization rule to a usable regular expression.
|
|
47
|
+
*/
|
|
48
|
+
function sanitizeRule(rule: RegExp | string): RegExp {
|
|
49
|
+
if (typeof rule === 'string') {
|
|
50
|
+
return new RegExp('^' + rule + '$', 'i')
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return rule
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Pass in a word token to produce a function that can replicate the case on
|
|
58
|
+
* another word.
|
|
59
|
+
*/
|
|
60
|
+
function restoreCase(word: string, token: string): string {
|
|
61
|
+
// Tokens are an exact match.
|
|
62
|
+
if (word === token) return token
|
|
63
|
+
|
|
64
|
+
// Lower cased words. E.g. "hello".
|
|
65
|
+
if (word === word.toLowerCase()) return token.toLowerCase()
|
|
66
|
+
|
|
67
|
+
// Upper cased words. E.g. "WHISKY".
|
|
68
|
+
if (word === word.toUpperCase()) return token.toUpperCase()
|
|
69
|
+
|
|
70
|
+
// Title cased words. E.g. "Title".
|
|
71
|
+
if (word.charAt(0) === word.charAt(0).toUpperCase()) {
|
|
72
|
+
return token.charAt(0).toUpperCase() + token.substring(1).toLowerCase()
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Lower cased words. E.g. "test".
|
|
76
|
+
return token.toLowerCase()
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Interpolate a regexp string.
|
|
81
|
+
*/
|
|
82
|
+
function interpolate(str: string, args: IArguments): string {
|
|
83
|
+
return str.replace(/\$(\d{1,2})/g, function (_match, index) {
|
|
84
|
+
return args[index] || ''
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Replace a word using a rule.
|
|
90
|
+
*/
|
|
91
|
+
function replace(word: string, rule: Rule): string {
|
|
92
|
+
return word.replace(rule[0], function (match, index) {
|
|
93
|
+
// eslint-disable-next-line prefer-rest-params
|
|
94
|
+
const result = interpolate(rule[1], arguments)
|
|
95
|
+
|
|
96
|
+
if (match === '') {
|
|
97
|
+
return restoreCase(word.charAt(index - 1), result)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return restoreCase(match, result)
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Sanitize a word by passing in the word and sanitization rules.
|
|
106
|
+
*/
|
|
107
|
+
function sanitizeWord(token: string, word: string, rules: Rule[]): string {
|
|
108
|
+
// Empty string or doesn't need fixing.
|
|
109
|
+
if (!token.length || Object.prototype.hasOwnProperty.call(uncountables, token)) {
|
|
110
|
+
return word
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
let len = rules.length
|
|
114
|
+
|
|
115
|
+
// Iterate over the sanitization rules and use the first one to match.
|
|
116
|
+
while (len--) {
|
|
117
|
+
const rule = rules[len]!
|
|
118
|
+
|
|
119
|
+
if (rule[0].test(word)) return replace(word, rule)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return word
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Replace a word with the updated word.
|
|
127
|
+
*/
|
|
128
|
+
function replaceWord(
|
|
129
|
+
replaceMap: Record<string, string>,
|
|
130
|
+
keepMap: Record<string, string>,
|
|
131
|
+
rules: Rule[]
|
|
132
|
+
): (word: string) => string {
|
|
133
|
+
return function (word: string): string {
|
|
134
|
+
// Get the correct token and case restoration functions.
|
|
135
|
+
const token = word.toLowerCase()
|
|
136
|
+
|
|
137
|
+
// Check against the keep object map.
|
|
138
|
+
if (Object.prototype.hasOwnProperty.call(keepMap, token)) {
|
|
139
|
+
return restoreCase(word, token)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Check against the replacement map for a direct word replacement.
|
|
143
|
+
if (Object.prototype.hasOwnProperty.call(replaceMap, token)) {
|
|
144
|
+
return restoreCase(word, replaceMap[token]!)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Run all the rules against the word.
|
|
148
|
+
return sanitizeWord(token, word, rules)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Check if a word is part of the map.
|
|
154
|
+
*/
|
|
155
|
+
function checkWord(
|
|
156
|
+
replaceMap: Record<string, string>,
|
|
157
|
+
keepMap: Record<string, string>,
|
|
158
|
+
rules: Rule[]
|
|
159
|
+
): (word: string) => boolean {
|
|
160
|
+
return function (word: string): boolean {
|
|
161
|
+
const token = word.toLowerCase()
|
|
162
|
+
|
|
163
|
+
if (Object.prototype.hasOwnProperty.call(keepMap, token)) return true
|
|
164
|
+
if (Object.prototype.hasOwnProperty.call(replaceMap, token)) return false
|
|
165
|
+
|
|
166
|
+
return sanitizeWord(token, token, rules) === token
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Pluralize a word.
|
|
172
|
+
*/
|
|
173
|
+
const plural = replaceWord(irregularSingles, irregularPlurals, pluralRules)
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Check if a word is plural.
|
|
177
|
+
*/
|
|
178
|
+
const isPlural = checkWord(irregularSingles, irregularPlurals, pluralRules)
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Singularize a word.
|
|
182
|
+
*/
|
|
183
|
+
const singular = replaceWord(irregularPlurals, irregularSingles, singularRules)
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Check if a word is singular.
|
|
187
|
+
*/
|
|
188
|
+
const isSingular = checkWord(irregularPlurals, irregularSingles, singularRules)
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Pluralize or singularize a word based on the passed in count.
|
|
192
|
+
*/
|
|
193
|
+
function pluralize(word: string, count?: number, inclusive?: boolean): string {
|
|
194
|
+
const pluralized = count === 1 ? singular(word) : plural(word)
|
|
195
|
+
|
|
196
|
+
return (inclusive ? count + ' ' : '') + pluralized
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function addPluralRule(rule: RegExp | string, replacement: string): void {
|
|
200
|
+
pluralRules.push([sanitizeRule(rule), replacement])
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function addSingularRule(rule: RegExp | string, replacement: string): void {
|
|
204
|
+
singularRules.push([sanitizeRule(rule), replacement])
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function addUncountableRule(word: RegExp | string): void {
|
|
208
|
+
if (typeof word === 'string') {
|
|
209
|
+
uncountables[word.toLowerCase()] = true
|
|
210
|
+
return
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Set singular and plural references for the word.
|
|
214
|
+
addPluralRule(word, '$0')
|
|
215
|
+
addSingularRule(word, '$0')
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function addIrregularRule(single: string, plural: string): void {
|
|
219
|
+
plural = plural.toLowerCase()
|
|
220
|
+
single = single.toLowerCase()
|
|
221
|
+
|
|
222
|
+
irregularSingles[single] = plural
|
|
223
|
+
irregularPlurals[plural] = single
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Irregular rules.
|
|
228
|
+
*/
|
|
229
|
+
;(
|
|
230
|
+
[
|
|
231
|
+
// Pronouns.
|
|
232
|
+
['I', 'we'],
|
|
233
|
+
['me', 'us'],
|
|
234
|
+
['he', 'they'],
|
|
235
|
+
['she', 'they'],
|
|
236
|
+
['them', 'them'],
|
|
237
|
+
['myself', 'ourselves'],
|
|
238
|
+
['yourself', 'yourselves'],
|
|
239
|
+
['itself', 'themselves'],
|
|
240
|
+
['herself', 'themselves'],
|
|
241
|
+
['himself', 'themselves'],
|
|
242
|
+
['themself', 'themselves'],
|
|
243
|
+
['is', 'are'],
|
|
244
|
+
['was', 'were'],
|
|
245
|
+
['has', 'have'],
|
|
246
|
+
['this', 'these'],
|
|
247
|
+
['that', 'those'],
|
|
248
|
+
// Words ending in with a consonant and `o`.
|
|
249
|
+
['echo', 'echoes'],
|
|
250
|
+
['dingo', 'dingoes'],
|
|
251
|
+
['volcano', 'volcanoes'],
|
|
252
|
+
['tornado', 'tornadoes'],
|
|
253
|
+
['torpedo', 'torpedoes'],
|
|
254
|
+
// Ends with `us`.
|
|
255
|
+
['genus', 'genera'],
|
|
256
|
+
['viscus', 'viscera'],
|
|
257
|
+
// Ends with `ma`.
|
|
258
|
+
['stigma', 'stigmata'],
|
|
259
|
+
['stoma', 'stomata'],
|
|
260
|
+
['dogma', 'dogmata'],
|
|
261
|
+
['lemma', 'lemmata'],
|
|
262
|
+
['schema', 'schemata'],
|
|
263
|
+
['anathema', 'anathemata'],
|
|
264
|
+
// Other irregular rules.
|
|
265
|
+
['ox', 'oxen'],
|
|
266
|
+
['axe', 'axes'],
|
|
267
|
+
['die', 'dice'],
|
|
268
|
+
['yes', 'yeses'],
|
|
269
|
+
['foot', 'feet'],
|
|
270
|
+
['eave', 'eaves'],
|
|
271
|
+
['goose', 'geese'],
|
|
272
|
+
['tooth', 'teeth'],
|
|
273
|
+
['quiz', 'quizzes'],
|
|
274
|
+
['human', 'humans'],
|
|
275
|
+
['proof', 'proofs'],
|
|
276
|
+
['carve', 'carves'],
|
|
277
|
+
['valve', 'valves'],
|
|
278
|
+
['looey', 'looies'],
|
|
279
|
+
['thief', 'thieves'],
|
|
280
|
+
['groove', 'grooves'],
|
|
281
|
+
['pickaxe', 'pickaxes'],
|
|
282
|
+
['passerby', 'passersby'],
|
|
283
|
+
] as Array<[string, string]>
|
|
284
|
+
).forEach((rule) => addIrregularRule(rule[0], rule[1]))
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Pluralization rules.
|
|
288
|
+
*/
|
|
289
|
+
;(
|
|
290
|
+
[
|
|
291
|
+
[/s?$/i, 's'],
|
|
292
|
+
[/[^\u0000-\u007F]$/i, '$0'],
|
|
293
|
+
[/([^aeiou]ese)$/i, '$1'],
|
|
294
|
+
[/(ax|test)is$/i, '$1es'],
|
|
295
|
+
[/(alias|[^aou]us|t[lm]as|gas|ris)$/i, '$1es'],
|
|
296
|
+
[/(e[mn]u)s?$/i, '$1s'],
|
|
297
|
+
[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, '$1'],
|
|
298
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1i'],
|
|
299
|
+
[/(alumn|alg|vertebr)(?:a|ae)$/i, '$1ae'],
|
|
300
|
+
[/(seraph|cherub)(?:im)?$/i, '$1im'],
|
|
301
|
+
[/(her|at|gr)o$/i, '$1oes'],
|
|
302
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, '$1a'],
|
|
303
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, '$1a'],
|
|
304
|
+
[/sis$/i, 'ses'],
|
|
305
|
+
[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, '$1$2ves'],
|
|
306
|
+
[/([^aeiouy]|qu)y$/i, '$1ies'],
|
|
307
|
+
[/([^ch][ieo][ln])ey$/i, '$1ies'],
|
|
308
|
+
[/(x|ch|ss|sh|zz)$/i, '$1es'],
|
|
309
|
+
[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, '$1ices'],
|
|
310
|
+
[/\b((?:tit)?m|l)(?:ice|ouse)$/i, '$1ice'],
|
|
311
|
+
[/(pe)(?:rson|ople)$/i, '$1ople'],
|
|
312
|
+
[/(child)(?:ren)?$/i, '$1ren'],
|
|
313
|
+
[/eaux$/i, '$0'],
|
|
314
|
+
[/m[ae]n$/i, 'men'],
|
|
315
|
+
['thou', 'you'],
|
|
316
|
+
] as Array<[RegExp | string, string]>
|
|
317
|
+
).forEach((rule) => addPluralRule(rule[0], rule[1]))
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Singularization rules.
|
|
321
|
+
*/
|
|
322
|
+
;(
|
|
323
|
+
[
|
|
324
|
+
[/s$/i, ''],
|
|
325
|
+
[/(ss)$/i, '$1'],
|
|
326
|
+
[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, '$1fe'],
|
|
327
|
+
[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, '$1f'],
|
|
328
|
+
[/ies$/i, 'y'],
|
|
329
|
+
[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, '$1ie'],
|
|
330
|
+
[/\b(mon|smil)ies$/i, '$1ey'],
|
|
331
|
+
[/\b((?:tit)?m|l)ice$/i, '$1ouse'],
|
|
332
|
+
[/(seraph|cherub)im$/i, '$1'],
|
|
333
|
+
[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, '$1'],
|
|
334
|
+
[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, '$1sis'],
|
|
335
|
+
[/(movie|twelve|abuse|e[mn]u)s$/i, '$1'],
|
|
336
|
+
[/(test)(?:is|es)$/i, '$1is'],
|
|
337
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1us'],
|
|
338
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, '$1um'],
|
|
339
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, '$1on'],
|
|
340
|
+
[/(alumn|alg|vertebr)ae$/i, '$1a'],
|
|
341
|
+
[/(cod|mur|sil|vert|ind)ices$/i, '$1ex'],
|
|
342
|
+
[/(matr|append)ices$/i, '$1ix'],
|
|
343
|
+
[/(pe)(rson|ople)$/i, '$1rson'],
|
|
344
|
+
[/(child)ren$/i, '$1'],
|
|
345
|
+
[/(eau)x?$/i, '$1'],
|
|
346
|
+
[/men$/i, 'man'],
|
|
347
|
+
] as Array<[RegExp | string, string]>
|
|
348
|
+
).forEach((rule) => addSingularRule(rule[0], rule[1]))
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Uncountable rules.
|
|
352
|
+
*/
|
|
353
|
+
;(
|
|
354
|
+
[
|
|
355
|
+
// Singular words with no plurals.
|
|
356
|
+
'adulthood',
|
|
357
|
+
'advice',
|
|
358
|
+
'agenda',
|
|
359
|
+
'aid',
|
|
360
|
+
'aircraft',
|
|
361
|
+
'alcohol',
|
|
362
|
+
'ammo',
|
|
363
|
+
'analytics',
|
|
364
|
+
'anime',
|
|
365
|
+
'athletics',
|
|
366
|
+
'audio',
|
|
367
|
+
'bison',
|
|
368
|
+
'blood',
|
|
369
|
+
'bream',
|
|
370
|
+
'buffalo',
|
|
371
|
+
'butter',
|
|
372
|
+
'carp',
|
|
373
|
+
'cash',
|
|
374
|
+
'chassis',
|
|
375
|
+
'chess',
|
|
376
|
+
'clothing',
|
|
377
|
+
'cod',
|
|
378
|
+
'commerce',
|
|
379
|
+
'cooperation',
|
|
380
|
+
'corps',
|
|
381
|
+
'debris',
|
|
382
|
+
'diabetes',
|
|
383
|
+
'digestion',
|
|
384
|
+
'elk',
|
|
385
|
+
'energy',
|
|
386
|
+
'equipment',
|
|
387
|
+
'excretion',
|
|
388
|
+
'expertise',
|
|
389
|
+
'firmware',
|
|
390
|
+
'flounder',
|
|
391
|
+
'fun',
|
|
392
|
+
'gallows',
|
|
393
|
+
'garbage',
|
|
394
|
+
'graffiti',
|
|
395
|
+
'hardware',
|
|
396
|
+
'headquarters',
|
|
397
|
+
'health',
|
|
398
|
+
'herpes',
|
|
399
|
+
'highjinks',
|
|
400
|
+
'homework',
|
|
401
|
+
'housework',
|
|
402
|
+
'information',
|
|
403
|
+
'jeans',
|
|
404
|
+
'justice',
|
|
405
|
+
'kudos',
|
|
406
|
+
'labour',
|
|
407
|
+
'literature',
|
|
408
|
+
'machinery',
|
|
409
|
+
'mackerel',
|
|
410
|
+
'mail',
|
|
411
|
+
'media',
|
|
412
|
+
'mews',
|
|
413
|
+
'moose',
|
|
414
|
+
'music',
|
|
415
|
+
'mud',
|
|
416
|
+
'manga',
|
|
417
|
+
'news',
|
|
418
|
+
'only',
|
|
419
|
+
'personnel',
|
|
420
|
+
'pike',
|
|
421
|
+
'plankton',
|
|
422
|
+
'pliers',
|
|
423
|
+
'police',
|
|
424
|
+
'pollution',
|
|
425
|
+
'premises',
|
|
426
|
+
'rain',
|
|
427
|
+
'research',
|
|
428
|
+
'rice',
|
|
429
|
+
'salmon',
|
|
430
|
+
'scissors',
|
|
431
|
+
'series',
|
|
432
|
+
'sewage',
|
|
433
|
+
'shambles',
|
|
434
|
+
'shrimp',
|
|
435
|
+
'software',
|
|
436
|
+
'species',
|
|
437
|
+
'staff',
|
|
438
|
+
'swine',
|
|
439
|
+
'tennis',
|
|
440
|
+
'traffic',
|
|
441
|
+
'transportation',
|
|
442
|
+
'trout',
|
|
443
|
+
'tuna',
|
|
444
|
+
'wealth',
|
|
445
|
+
'welfare',
|
|
446
|
+
'whiting',
|
|
447
|
+
'wildebeest',
|
|
448
|
+
'wildlife',
|
|
449
|
+
'you',
|
|
450
|
+
/pok[eé]mon$/i,
|
|
451
|
+
// Regexes.
|
|
452
|
+
/[^aeiou]ese$/i, // "chinese", "japanese"
|
|
453
|
+
/deer$/i, // "deer", "reindeer"
|
|
454
|
+
/fish$/i, // "fish", "blowfish", "angelfish"
|
|
455
|
+
/measles$/i,
|
|
456
|
+
/o[iu]s$/i, // "carnivorous"
|
|
457
|
+
/pox$/i, // "chickpox", "smallpox"
|
|
458
|
+
/sheep$/i,
|
|
459
|
+
] as Array<RegExp | string>
|
|
460
|
+
).forEach(addUncountableRule)
|
|
461
|
+
|
|
462
|
+
pluralize.plural = plural
|
|
463
|
+
pluralize.isPlural = isPlural
|
|
464
|
+
pluralize.singular = singular
|
|
465
|
+
pluralize.isSingular = isSingular
|
|
466
|
+
pluralize.addPluralRule = addPluralRule
|
|
467
|
+
pluralize.addSingularRule = addSingularRule
|
|
468
|
+
pluralize.addUncountableRule = addUncountableRule
|
|
469
|
+
pluralize.addIrregularRule = addIrregularRule
|
|
470
|
+
|
|
471
|
+
export { plural, isPlural, singular, isSingular, addPluralRule, addSingularRule, addUncountableRule, addIrregularRule }
|
|
472
|
+
export default pluralize
|
package/src/vite/qdadmPlugin.ts
CHANGED
|
@@ -23,13 +23,11 @@
|
|
|
23
23
|
* - `optimizeDeps.exclude` keeps primevue/@primeuix/themes/qdadm out of the
|
|
24
24
|
* pre-bundle so BOTH pipelines resolve the same raw modules. Excluding
|
|
25
25
|
* qdadm also keeps HMR sane when the package is consumed via a symlink.
|
|
26
|
-
* -
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* nested path can't resolve) forms are declared; the unused one is a
|
|
32
|
-
* no-op warning at worst.
|
|
26
|
+
* - qdadm has NO CJS transitives (pluralize is vendored as ESM, #1454), so
|
|
27
|
+
* there is nothing to `optimizeDeps.include` — which also means nothing
|
|
28
|
+
* for the optimizer to fail resolving in file:-linked installs where
|
|
29
|
+
* npm (install-links=false) never materializes qdadm's deps at the
|
|
30
|
+
* consumer root.
|
|
33
31
|
* - When `node_modules/@quazardous/qdadm` is a symlink (file:/workspace
|
|
34
32
|
* link — qdadm's own dev mode against a testbed app), its realpath is
|
|
35
33
|
* appended to `server.fs.allow` so qdadm's `?raw` dynamic imports (i18n
|
|
@@ -44,9 +42,6 @@ import fs from 'node:fs'
|
|
|
44
42
|
import path from 'node:path'
|
|
45
43
|
import { searchForWorkspaceRoot, type Plugin, type UserConfig } from 'vite'
|
|
46
44
|
|
|
47
|
-
/** qdadm's CJS transitive deps that must be pre-bundled (internal knowledge). */
|
|
48
|
-
const CJS_TRANSITIVES = ['pluralize']
|
|
49
|
-
|
|
50
45
|
export interface QdadmVitePluginOptions {
|
|
51
46
|
/**
|
|
52
47
|
* Extra packages to dedupe on top of the defaults
|
|
@@ -84,12 +79,10 @@ export function qdadmVitePlugin(options: QdadmVitePluginOptions = {}): Plugin {
|
|
|
84
79
|
// Symlinked install (file:/workspace link)? Allow serving from the
|
|
85
80
|
// link target, which typically lives outside the consumer's root.
|
|
86
81
|
const fsAllow: string[] = []
|
|
87
|
-
let symlinked = false
|
|
88
82
|
try {
|
|
89
83
|
const pkgDir = path.join(root, 'node_modules', '@quazardous', 'qdadm')
|
|
90
84
|
const real = fs.realpathSync(pkgDir)
|
|
91
85
|
if (real !== pkgDir) {
|
|
92
|
-
symlinked = true
|
|
93
86
|
fsAllow.push(searchForWorkspaceRoot(root), real)
|
|
94
87
|
}
|
|
95
88
|
} catch {
|
|
@@ -123,13 +116,6 @@ export function qdadmVitePlugin(options: QdadmVitePluginOptions = {}): Plugin {
|
|
|
123
116
|
},
|
|
124
117
|
optimizeDeps: {
|
|
125
118
|
exclude: [...widgetExcludes, ...themesExcludes, '@quazardous/qdadm'],
|
|
126
|
-
// One form per install mode: the nested path resolves through a
|
|
127
|
-
// real node_modules chain (npm installs), the plain form through a
|
|
128
|
-
// symlink realpath — declaring the unused one logs a "Failed to
|
|
129
|
-
// resolve dependency" warning (skybot testbed, #1389).
|
|
130
|
-
include: symlinked
|
|
131
|
-
? [...CJS_TRANSITIVES]
|
|
132
|
-
: CJS_TRANSITIVES.map((dep) => `@quazardous/qdadm > ${dep}`),
|
|
133
119
|
},
|
|
134
120
|
...(fsAllow.length > 0 ? { server: { fs: { allow: fsAllow } } } : {}),
|
|
135
121
|
}
|
package/src/vite-env.d.ts
CHANGED
|
@@ -32,19 +32,3 @@ declare module '*.sass' {
|
|
|
32
32
|
const content: string
|
|
33
33
|
export default content
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
// `pluralize` ships as plain JS without bundled `.d.ts`. The official
|
|
37
|
-
// types live in `@types/pluralize` but pulling them in as a runtime
|
|
38
|
-
// dep here is overkill for a single-call usage. Declare the minimum
|
|
39
|
-
// surface we use so `strict` mode is happy without DefinitelyTyped.
|
|
40
|
-
declare module 'pluralize' {
|
|
41
|
-
interface PluralizeFn {
|
|
42
|
-
(word: string, count?: number, inclusive?: boolean): string
|
|
43
|
-
singular(word: string): string
|
|
44
|
-
plural(word: string, count?: number, inclusive?: boolean): string
|
|
45
|
-
isPlural(word: string): boolean
|
|
46
|
-
isSingular(word: string): boolean
|
|
47
|
-
}
|
|
48
|
-
const pluralize: PluralizeFn
|
|
49
|
-
export default pluralize
|
|
50
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TestManager - Auto-generated EntityManager
|
|
3
|
-
*
|
|
4
|
-
* Generated by qdadm/gen/generateManagers
|
|
5
|
-
* DO NOT EDIT MANUALLY - Changes will be overwritten
|
|
6
|
-
*
|
|
7
|
-
* Entity: test
|
|
8
|
-
* Endpoint: /test
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { EntityManager } from '@quazardous/qdadm'
|
|
12
|
-
import { ApiStorage } from '@quazardous/qdadm'
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Schema definition for test
|
|
16
|
-
* @type {import('qdadm/gen').UnifiedEntitySchema}
|
|
17
|
-
*/
|
|
18
|
-
export const testSchema = {
|
|
19
|
-
name: "test",
|
|
20
|
-
endpoint: "/test",
|
|
21
|
-
fields: {}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Storage options for test
|
|
26
|
-
*/
|
|
27
|
-
const storageOptions = {
|
|
28
|
-
endpoint: "/test"
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* TestManager instance
|
|
33
|
-
*
|
|
34
|
-
* Provides CRUD operations for test entity.
|
|
35
|
-
*
|
|
36
|
-
* @type {EntityManager}
|
|
37
|
-
*/
|
|
38
|
-
export const testManager = new EntityManager({
|
|
39
|
-
...{
|
|
40
|
-
name: "test",
|
|
41
|
-
idField: "id",
|
|
42
|
-
fields: {}
|
|
43
|
-
},
|
|
44
|
-
storage: new ApiStorage(storageOptions)
|
|
45
|
-
})
|
package/src/types/pluralize.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type declarations for pluralize module
|
|
3
|
-
*/
|
|
4
|
-
declare module 'pluralize' {
|
|
5
|
-
function pluralize(word: string, count?: number, inclusive?: boolean): string
|
|
6
|
-
|
|
7
|
-
namespace pluralize {
|
|
8
|
-
function plural(word: string): string
|
|
9
|
-
function singular(word: string): string
|
|
10
|
-
function isPlural(word: string): boolean
|
|
11
|
-
function isSingular(word: string): boolean
|
|
12
|
-
function addPluralRule(rule: string | RegExp, replacement: string): void
|
|
13
|
-
function addSingularRule(rule: string | RegExp, replacement: string): void
|
|
14
|
-
function addIrregularRule(single: string, plural: string): void
|
|
15
|
-
function addUncountableRule(word: string | RegExp): void
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export = pluralize
|
|
19
|
-
}
|