oc 0.50.58 → 0.50.60
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/.turbo/turbo-build.log +4 -4
- package/.turbo/turbo-test-silent.log +11 -8
- package/.turbo/turbo-test.log +1750 -1748
- package/CHANGELOG.md +19 -0
- package/dist/cli/domain/ocConfig.js +8 -0
- package/dist/cli/facade/dev.js +3 -3
- package/dist/cli/facade/publish.js +2 -2
- package/dist/cli/facade/validate.js +2 -2
- package/dist/cli/logger.js +2 -2
- package/dist/components/oc-client/_package/package.json +4 -4
- package/dist/components/oc-client/_package/server.js +1 -1
- package/dist/components/oc-client/_package/src/oc-client.js +3 -7
- package/dist/components/oc-client/_package/src/oc-client.min.js +1 -1
- package/dist/components/oc-client/_package/src/oc-client.min.map +1 -1
- package/dist/components/oc-client/package-lock.json +9 -23
- package/dist/components/oc-client/package.json +1 -1
- package/dist/components/oc-client/src/oc-client.js +3 -7
- package/dist/components/oc-client/src/oc-client.min.js +1 -1
- package/dist/components/oc-client/src/oc-client.min.map +1 -1
- package/dist/registry/app-start.js +8 -8
- package/dist/registry/domain/events-handler.d.ts +1 -0
- package/dist/registry/domain/events-handler.js +3 -0
- package/dist/registry/domain/http-server/express-adapter.js +7 -1
- package/dist/registry/domain/nested-renderer.js +16 -16
- package/dist/registry/domain/options-sanitiser.d.ts +14 -1
- package/dist/registry/domain/options-sanitiser.js +24 -1
- package/dist/registry/domain/validators/plugins-requirements.d.ts +1 -1
- package/dist/registry/domain/validators/plugins-requirements.js +4 -2
- package/dist/registry/domain/validators/registry-configuration.d.ts +1 -1
- package/dist/registry/domain/version-handler.js +8 -6
- package/dist/registry/index.js +2 -2
- package/dist/registry/middleware/index.js +3 -0
- package/dist/registry/routes/components.js +20 -21
- package/dist/registry/routes/helpers/get-component.d.ts +1 -0
- package/dist/registry/routes/helpers/get-component.js +123 -63
- package/dist/resources/index.js +8 -8
- package/dist/types.d.ts +17 -0
- package/dist/utils/colors.d.ts +14 -0
- package/dist/utils/colors.js +21 -0
- package/dist/utils/deprecate.d.ts +20 -0
- package/dist/utils/deprecate.js +21 -0
- package/package.json +5 -7
|
@@ -123,21 +123,53 @@ function getComponent(conf, repository) {
|
|
|
123
123
|
refreshInterval: conf.refreshInterval
|
|
124
124
|
});
|
|
125
125
|
const convertPlugins = pluginConverter(conf.plugins);
|
|
126
|
+
const customHeadersByConfig = new WeakMap();
|
|
127
|
+
const pluginNamesByConfig = new WeakMap();
|
|
128
|
+
const getCustomHeadersToSkip = (config) => {
|
|
129
|
+
if (!customHeadersByConfig.has(config)) {
|
|
130
|
+
customHeadersByConfig.set(config, config.customHeadersToSkipOnWeakVersion?.length
|
|
131
|
+
? new Set(config.customHeadersToSkipOnWeakVersion)
|
|
132
|
+
: undefined);
|
|
133
|
+
}
|
|
134
|
+
return customHeadersByConfig.get(config);
|
|
135
|
+
};
|
|
136
|
+
const getRegistryPluginNames = (config) => {
|
|
137
|
+
let names = pluginNamesByConfig.get(config);
|
|
138
|
+
if (!names) {
|
|
139
|
+
names = new Set(Object.keys(config.plugins || {}));
|
|
140
|
+
pluginNamesByConfig.set(config, names);
|
|
141
|
+
}
|
|
142
|
+
return names;
|
|
143
|
+
};
|
|
144
|
+
const inFlight = new Map();
|
|
145
|
+
const singleFlight = (key, operation) => {
|
|
146
|
+
const pending = inFlight.get(key);
|
|
147
|
+
if (pending) {
|
|
148
|
+
return pending;
|
|
149
|
+
}
|
|
150
|
+
const promise = operation().finally(() => {
|
|
151
|
+
inFlight.delete(key);
|
|
152
|
+
});
|
|
153
|
+
inFlight.set(key, promise);
|
|
154
|
+
return promise;
|
|
155
|
+
};
|
|
126
156
|
const getEnv = async (component) => {
|
|
127
157
|
const cacheKey = `${component.name}/${component.version}/.env`;
|
|
128
158
|
const cached = cache.get('file-contents', cacheKey);
|
|
129
159
|
if (cached)
|
|
130
160
|
return cached;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
161
|
+
return singleFlight(cacheKey, async () => {
|
|
162
|
+
const env = component.oc.files.env
|
|
163
|
+
? await repository.getEnv(component.name, component.version)
|
|
164
|
+
: {};
|
|
165
|
+
cache.set('file-contents', cacheKey, env);
|
|
166
|
+
return env;
|
|
167
|
+
});
|
|
136
168
|
};
|
|
137
169
|
const renderer = async (options, cb) => {
|
|
138
170
|
const nestedRenderer = (0, nested_renderer_1.default)(renderer, options.conf);
|
|
139
171
|
const retrievingInfo = (0, get_component_retrieving_info_1.default)(options);
|
|
140
|
-
let responseHeaders
|
|
172
|
+
let responseHeaders;
|
|
141
173
|
const responseCookies = [];
|
|
142
174
|
const getLanguage = () => {
|
|
143
175
|
const paramOverride = !!options.parameters && options.parameters['__ocAcceptLanguage'];
|
|
@@ -159,11 +191,8 @@ function getComponent(conf, repository) {
|
|
|
159
191
|
return cb(result);
|
|
160
192
|
};
|
|
161
193
|
let componentCallbackDone = false;
|
|
194
|
+
let callbackTimeout;
|
|
162
195
|
const conf = options.conf;
|
|
163
|
-
const customHeadersToSkipSet = conf.customHeadersToSkipOnWeakVersion?.length
|
|
164
|
-
? new Set(conf.customHeadersToSkipOnWeakVersion)
|
|
165
|
-
: undefined;
|
|
166
|
-
const acceptLanguage = getLanguage();
|
|
167
196
|
const requestedComponent = {
|
|
168
197
|
name: options.name,
|
|
169
198
|
version: options.version || '',
|
|
@@ -196,7 +225,7 @@ function getComponent(conf, repository) {
|
|
|
196
225
|
});
|
|
197
226
|
}
|
|
198
227
|
// check component requirements are satisfied by registry
|
|
199
|
-
const pluginsCompatibility = validator.validatePluginsRequirements(component.oc.plugins, conf
|
|
228
|
+
const pluginsCompatibility = validator.validatePluginsRequirements(component.oc.plugins, getRegistryPluginNames(conf));
|
|
200
229
|
if (!pluginsCompatibility.isValid) {
|
|
201
230
|
return callback({
|
|
202
231
|
status: 501,
|
|
@@ -249,7 +278,10 @@ function getComponent(conf, repository) {
|
|
|
249
278
|
});
|
|
250
279
|
}
|
|
251
280
|
const filterCustomHeaders = (headers, requestedVersion, actualVersion) => {
|
|
252
|
-
|
|
281
|
+
const customHeadersToSkipSet = getCustomHeadersToSkip(conf);
|
|
282
|
+
if (!headers ||
|
|
283
|
+
!customHeadersToSkipSet ||
|
|
284
|
+
requestedVersion === actualVersion) {
|
|
253
285
|
return headers;
|
|
254
286
|
}
|
|
255
287
|
let filteredHeaders;
|
|
@@ -259,28 +291,32 @@ function getComponent(conf, repository) {
|
|
|
259
291
|
filteredHeaders[key] = headers[key];
|
|
260
292
|
}
|
|
261
293
|
}
|
|
262
|
-
return filteredHeaders
|
|
294
|
+
return filteredHeaders;
|
|
263
295
|
};
|
|
264
296
|
const returnComponent = async (err, data) => {
|
|
265
297
|
if (componentCallbackDone) {
|
|
266
298
|
return;
|
|
267
299
|
}
|
|
268
300
|
componentCallbackDone = true;
|
|
301
|
+
if (callbackTimeout) {
|
|
302
|
+
clearTimeout(callbackTimeout);
|
|
303
|
+
callbackTimeout = undefined;
|
|
304
|
+
}
|
|
269
305
|
const componentHref = urlBuilder.component({
|
|
270
306
|
name: component.name,
|
|
271
307
|
version: requestedComponent.version,
|
|
272
308
|
parameters: params
|
|
273
309
|
}, conf.baseUrl);
|
|
274
310
|
const isUnrendered = options.headers.accept === settings_1.default.registry.acceptUnrenderedHeader;
|
|
275
|
-
const isValidClientRequest = options.headers['user-agent']
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
311
|
+
const isValidClientRequest = String(options.headers['user-agent'] || '').includes('oc-client-');
|
|
312
|
+
const templatesHeader = options.headers['templates'];
|
|
313
|
+
let isTemplateSupportedByClient = false;
|
|
314
|
+
if (isUnrendered && isValidClientRequest && templatesHeader) {
|
|
315
|
+
const supportedTemplates = parseTemplatesHeader(templatesHeader);
|
|
316
|
+
isTemplateSupportedByClient =
|
|
317
|
+
supportedTemplates.includes(component.oc.files.template.type) ||
|
|
318
|
+
supportedTemplates.includes(templateType);
|
|
319
|
+
}
|
|
284
320
|
let renderMode = options.action ? 'unrendered' : 'rendered';
|
|
285
321
|
if (isUnrendered) {
|
|
286
322
|
renderMode = 'unrendered';
|
|
@@ -356,7 +392,7 @@ function getComponent(conf, repository) {
|
|
|
356
392
|
if (renderMode === 'unrendered') {
|
|
357
393
|
callback({
|
|
358
394
|
status: 200,
|
|
359
|
-
headers: responseHeaders,
|
|
395
|
+
...(responseHeaders ? { headers: responseHeaders } : {}),
|
|
360
396
|
response: Object.assign(response, {
|
|
361
397
|
data: data,
|
|
362
398
|
template: {
|
|
@@ -396,7 +432,7 @@ function getComponent(conf, repository) {
|
|
|
396
432
|
}
|
|
397
433
|
callback({
|
|
398
434
|
status: 200,
|
|
399
|
-
headers: responseHeaders,
|
|
435
|
+
...(responseHeaders ? { headers: responseHeaders } : {}),
|
|
400
436
|
response: Object.assign(response, { html })
|
|
401
437
|
});
|
|
402
438
|
});
|
|
@@ -405,18 +441,30 @@ function getComponent(conf, repository) {
|
|
|
405
441
|
returnResult(cached);
|
|
406
442
|
}
|
|
407
443
|
else {
|
|
408
|
-
|
|
444
|
+
const loadTemplate = async () => {
|
|
445
|
+
const templateText = await repository.getCompiledView(component.name, component.version);
|
|
409
446
|
const template = ocTemplate.getCompiledTemplate(templateText, key);
|
|
410
447
|
cache.set('file-contents', cacheKey, template);
|
|
411
|
-
|
|
412
|
-
}
|
|
448
|
+
return template;
|
|
449
|
+
};
|
|
450
|
+
const templatePromise = conf.hotReloading
|
|
451
|
+
? loadTemplate()
|
|
452
|
+
: singleFlight(cacheKey, loadTemplate);
|
|
453
|
+
templatePromise.then(returnResult).catch((error) => callback({
|
|
454
|
+
status: 500,
|
|
455
|
+
response: {
|
|
456
|
+
code: 'INTERNAL_SERVER_ERROR',
|
|
457
|
+
error
|
|
458
|
+
}
|
|
459
|
+
}));
|
|
413
460
|
}
|
|
414
461
|
}
|
|
415
462
|
};
|
|
416
463
|
const staticPath = repository
|
|
417
464
|
.getStaticFilePath(component.name, component.version, '')
|
|
418
465
|
.replace(/^https:/, '');
|
|
419
|
-
|
|
466
|
+
const dataProviderDisabled = conf.dataProvider?.enabled === false;
|
|
467
|
+
if (dataProviderDisabled || !component.oc.files.dataProvider) {
|
|
420
468
|
const { __oc_Retry, ...props } = params;
|
|
421
469
|
props['_staticPath'] = staticPath;
|
|
422
470
|
props['_baseUrl'] = conf.baseUrl;
|
|
@@ -440,9 +488,13 @@ function getComponent(conf, repository) {
|
|
|
440
488
|
const cached = cache.get('file-contents', cacheKey);
|
|
441
489
|
const domain = node_domain_1.default.create();
|
|
442
490
|
const setEmptyResponse = oc_empty_response_handler_1.default.contextDecorator(returnComponent);
|
|
491
|
+
let parsedAcceptLanguage;
|
|
443
492
|
const contextObj = {
|
|
444
493
|
action: options.action,
|
|
445
|
-
acceptLanguage
|
|
494
|
+
get acceptLanguage() {
|
|
495
|
+
parsedAcceptLanguage ??= accept_language_parser_1.default.parse(getLanguage());
|
|
496
|
+
return parsedAcceptLanguage;
|
|
497
|
+
},
|
|
446
498
|
baseUrl: conf.baseUrl,
|
|
447
499
|
env: { ...conf.env, ...env },
|
|
448
500
|
params,
|
|
@@ -479,7 +531,7 @@ function getComponent(conf, repository) {
|
|
|
479
531
|
const setCallbackTimeout = () => {
|
|
480
532
|
const executionTimeout = conf.executionTimeout;
|
|
481
533
|
if (executionTimeout) {
|
|
482
|
-
setTimeout(() => {
|
|
534
|
+
callbackTimeout = setTimeout(() => {
|
|
483
535
|
const message = `timeout (${executionTimeout * 1000}ms)`;
|
|
484
536
|
returnComponent({ message }, undefined);
|
|
485
537
|
domain.exit();
|
|
@@ -490,8 +542,8 @@ function getComponent(conf, repository) {
|
|
|
490
542
|
domain.on('error', returnComponent);
|
|
491
543
|
try {
|
|
492
544
|
domain.run(() => {
|
|
493
|
-
cached(contextObj, returnComponent);
|
|
494
545
|
setCallbackTimeout();
|
|
546
|
+
cached(contextObj, returnComponent);
|
|
495
547
|
});
|
|
496
548
|
}
|
|
497
549
|
catch (e) {
|
|
@@ -499,17 +551,36 @@ function getComponent(conf, repository) {
|
|
|
499
551
|
}
|
|
500
552
|
}
|
|
501
553
|
else {
|
|
502
|
-
|
|
503
|
-
if (err) {
|
|
554
|
+
const handleError = (err) => {
|
|
555
|
+
if (err.code === 'DATA_RESOLVING_ERROR') {
|
|
504
556
|
componentCallbackDone = true;
|
|
505
557
|
return callback({
|
|
506
558
|
status: 502,
|
|
507
559
|
response: {
|
|
508
|
-
code:
|
|
560
|
+
code: err.code,
|
|
509
561
|
error: resources_1.default.errors.registry.RESOLVING_ERROR
|
|
510
562
|
}
|
|
511
563
|
});
|
|
512
564
|
}
|
|
565
|
+
if (err.code === 'DEPENDENCY_MISSING_FROM_REGISTRY') {
|
|
566
|
+
componentCallbackDone = true;
|
|
567
|
+
return callback({
|
|
568
|
+
status: 501,
|
|
569
|
+
response: {
|
|
570
|
+
code: err.code,
|
|
571
|
+
error: resources_1.default.errors.registry.DEPENDENCY_NOT_FOUND(err.missing.join(', ')),
|
|
572
|
+
missingDependencies: err.missing
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
returnComponent(err, undefined);
|
|
577
|
+
};
|
|
578
|
+
const loadDataProvider = async () => {
|
|
579
|
+
const dataProvider = await repository
|
|
580
|
+
.getDataProvider(component.name, component.version)
|
|
581
|
+
.catch(() => {
|
|
582
|
+
throw { code: 'DATA_RESOLVING_ERROR', missing: [] };
|
|
583
|
+
});
|
|
513
584
|
const context = {
|
|
514
585
|
require: (0, require_wrapper_1.default)(conf.dependencies),
|
|
515
586
|
module: {
|
|
@@ -538,40 +609,29 @@ function getComponent(conf, repository) {
|
|
|
538
609
|
}
|
|
539
610
|
}
|
|
540
611
|
};
|
|
541
|
-
const
|
|
542
|
-
if (err.code === 'DEPENDENCY_MISSING_FROM_REGISTRY') {
|
|
543
|
-
componentCallbackDone = true;
|
|
544
|
-
return callback({
|
|
545
|
-
status: 501,
|
|
546
|
-
response: {
|
|
547
|
-
code: err.code,
|
|
548
|
-
error: resources_1.default.errors.registry.DEPENDENCY_NOT_FOUND(err.missing.join(', ')),
|
|
549
|
-
missingDependencies: err.missing
|
|
550
|
-
}
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
returnComponent(err, undefined);
|
|
554
|
-
};
|
|
555
|
-
const options = conf.local
|
|
612
|
+
const vmOptions = conf.local
|
|
556
613
|
? {
|
|
557
614
|
displayErrors: true,
|
|
558
615
|
filename: dataProvider.filePath
|
|
559
616
|
}
|
|
560
617
|
: {};
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
618
|
+
node_vm_1.default.runInNewContext(dataProvider.content, context, vmOptions);
|
|
619
|
+
const processData = context.module.exports['data'] || context.exports['data'];
|
|
620
|
+
cache.set('file-contents', cacheKey, processData);
|
|
621
|
+
return processData;
|
|
622
|
+
};
|
|
623
|
+
const dataProviderPromise = conf.hotReloading
|
|
624
|
+
? loadDataProvider()
|
|
625
|
+
: singleFlight(cacheKey, loadDataProvider);
|
|
626
|
+
dataProviderPromise
|
|
627
|
+
.then((processData) => {
|
|
628
|
+
domain.on('error', handleError);
|
|
629
|
+
domain.run(() => {
|
|
630
|
+
setCallbackTimeout();
|
|
631
|
+
processData(contextObj, returnComponent);
|
|
632
|
+
});
|
|
633
|
+
})
|
|
634
|
+
.catch(handleError);
|
|
575
635
|
}
|
|
576
636
|
});
|
|
577
637
|
}
|
package/dist/resources/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const colors_1 = require("../utils/colors");
|
|
4
4
|
// Kind of long multi-string messages and functions
|
|
5
5
|
const validFunctionMock = `// simplified mock signature
|
|
6
6
|
module.exports = (a, b) => a+b;`;
|
|
@@ -23,24 +23,24 @@ const mockPluginIsNotValid = `Looks like you are trying to register a dynamic mo
|
|
|
23
23
|
The entry point should be a synchronous function or an object containing an asynchronous register() function and a synchronous execute() function.
|
|
24
24
|
Example:
|
|
25
25
|
|
|
26
|
-
${(0,
|
|
26
|
+
${(0, colors_1.yellow)(validFunctionMock)}
|
|
27
27
|
|
|
28
|
-
${(0,
|
|
28
|
+
${(0, colors_1.yellow)(validMockObject)}`;
|
|
29
29
|
const initSuccess = (componentName, componentPath) => {
|
|
30
30
|
const success = `Success! Created ${componentName} at ${componentPath}`;
|
|
31
|
-
return `${(0,
|
|
31
|
+
return `${(0, colors_1.green)(success)}
|
|
32
32
|
|
|
33
33
|
From here you can run several commands
|
|
34
34
|
|
|
35
|
-
${(0,
|
|
35
|
+
${(0, colors_1.green)('oc --help')}
|
|
36
36
|
To see a detailed list of all the commands available
|
|
37
37
|
|
|
38
38
|
We suggest that you begin by typing:
|
|
39
39
|
|
|
40
|
-
${(0,
|
|
40
|
+
${(0, colors_1.green)('oc dev . 3030')}
|
|
41
41
|
|
|
42
42
|
If you have questions, issues or feedback about OpenComponents, please, join us on Gitter:
|
|
43
|
-
${(0,
|
|
43
|
+
${(0, colors_1.green)('https://gitter.im/opentable/oc')}
|
|
44
44
|
|
|
45
45
|
Happy coding
|
|
46
46
|
|
|
@@ -156,7 +156,7 @@ exports.default = {
|
|
|
156
156
|
cleanSuccess: 'Folders removed',
|
|
157
157
|
initSuccess,
|
|
158
158
|
installCompiler: (compiler) => `Installing ${compiler} from npm...`,
|
|
159
|
-
installCompilerSuccess: (template, compiler, version) => `${(0,
|
|
159
|
+
installCompilerSuccess: (template, compiler, version) => `${(0, colors_1.green)('✔')} Installed ${compiler} [${template} v${version}]`,
|
|
160
160
|
legacyTemplateDeprecationWarning: (legacyType, newType) => `Template-type "${legacyType}" has been deprecated and is now replaced by "${newType}"`,
|
|
161
161
|
CHANGES_DETECTED: (file) => `Changes detected on file: ${file}`,
|
|
162
162
|
CHECKING_DEPENDENCIES: 'Ensuring dependencies are loaded...',
|
package/dist/types.d.ts
CHANGED
|
@@ -239,6 +239,23 @@ export interface Config<T = any, TServerAdapter extends HttpServerAdapterFactory
|
|
|
239
239
|
* @example ["lodash", "moment"]
|
|
240
240
|
*/
|
|
241
241
|
dependencies: string[];
|
|
242
|
+
/**
|
|
243
|
+
* Configuration for the data provider step, i.e. the component's `server.js`
|
|
244
|
+
* that produces the model consumed by the view.
|
|
245
|
+
*/
|
|
246
|
+
dataProvider: {
|
|
247
|
+
/**
|
|
248
|
+
* Executes the component's own data provider (`server.js`) when it has one.
|
|
249
|
+
*
|
|
250
|
+
* When `false` the registry never fetches nor runs a component's data
|
|
251
|
+
* provider, even if one exists in the storage: every component is served
|
|
252
|
+
* through the same path used by components that ship no `server.js`, i.e.
|
|
253
|
+
* the request parameters are passed straight through as the view model.
|
|
254
|
+
*
|
|
255
|
+
* @default true
|
|
256
|
+
*/
|
|
257
|
+
enabled: boolean;
|
|
258
|
+
};
|
|
242
259
|
/**
|
|
243
260
|
* Configuration object to enable/disable the HTML discovery page and the API
|
|
244
261
|
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const colors: {
|
|
2
|
+
black: import("picocolors/types").Formatter;
|
|
3
|
+
red: import("picocolors/types").Formatter;
|
|
4
|
+
green: import("picocolors/types").Formatter;
|
|
5
|
+
yellow: import("picocolors/types").Formatter;
|
|
6
|
+
blue: import("picocolors/types").Formatter;
|
|
7
|
+
magenta: import("picocolors/types").Formatter;
|
|
8
|
+
cyan: import("picocolors/types").Formatter;
|
|
9
|
+
white: import("picocolors/types").Formatter;
|
|
10
|
+
gray: import("picocolors/types").Formatter;
|
|
11
|
+
grey: import("picocolors/types").Formatter;
|
|
12
|
+
};
|
|
13
|
+
export declare const black: import("picocolors/types").Formatter, red: import("picocolors/types").Formatter, green: import("picocolors/types").Formatter, yellow: import("picocolors/types").Formatter, blue: import("picocolors/types").Formatter, magenta: import("picocolors/types").Formatter, cyan: import("picocolors/types").Formatter, white: import("picocolors/types").Formatter, gray: import("picocolors/types").Formatter, grey: import("picocolors/types").Formatter;
|
|
14
|
+
export default colors;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.grey = exports.gray = exports.white = exports.cyan = exports.magenta = exports.blue = exports.yellow = exports.green = exports.red = exports.black = void 0;
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
|
+
const colors = {
|
|
9
|
+
black: picocolors_1.default.black,
|
|
10
|
+
red: picocolors_1.default.red,
|
|
11
|
+
green: picocolors_1.default.green,
|
|
12
|
+
yellow: picocolors_1.default.yellow,
|
|
13
|
+
blue: picocolors_1.default.blue,
|
|
14
|
+
magenta: picocolors_1.default.magenta,
|
|
15
|
+
cyan: picocolors_1.default.cyan,
|
|
16
|
+
white: picocolors_1.default.white,
|
|
17
|
+
gray: picocolors_1.default.gray,
|
|
18
|
+
grey: picocolors_1.default.gray
|
|
19
|
+
};
|
|
20
|
+
exports.black = colors.black, exports.red = colors.red, exports.green = colors.green, exports.yellow = colors.yellow, exports.blue = colors.blue, exports.magenta = colors.magenta, exports.cyan = colors.cyan, exports.white = colors.white, exports.gray = colors.gray, exports.grey = colors.grey;
|
|
21
|
+
exports.default = colors;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface DeprecationNotice {
|
|
2
|
+
/** Stable identifier used to only warn once per process for this deprecation. */
|
|
3
|
+
id: string;
|
|
4
|
+
/** The option/API being removed. */
|
|
5
|
+
subject: string;
|
|
6
|
+
/** What to use instead. */
|
|
7
|
+
replacement: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Emits a single, consistent deprecation notice (once per process, per `id`)
|
|
11
|
+
* for a config option or API that will be removed in OpenComponents v1.
|
|
12
|
+
*
|
|
13
|
+
* Routes through `process.emitWarning` with type `DeprecationWarning`, so it
|
|
14
|
+
* honors the standard Node.js opt-out mechanisms (`--no-deprecation`, etc.)
|
|
15
|
+
* without needing a bespoke env var.
|
|
16
|
+
*
|
|
17
|
+
* This never changes runtime behavior - it is purely informational.
|
|
18
|
+
*/
|
|
19
|
+
export default function deprecate({ id, subject, replacement }: DeprecationNotice): void;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = deprecate;
|
|
4
|
+
const warned = new Set();
|
|
5
|
+
/**
|
|
6
|
+
* Emits a single, consistent deprecation notice (once per process, per `id`)
|
|
7
|
+
* for a config option or API that will be removed in OpenComponents v1.
|
|
8
|
+
*
|
|
9
|
+
* Routes through `process.emitWarning` with type `DeprecationWarning`, so it
|
|
10
|
+
* honors the standard Node.js opt-out mechanisms (`--no-deprecation`, etc.)
|
|
11
|
+
* without needing a bespoke env var.
|
|
12
|
+
*
|
|
13
|
+
* This never changes runtime behavior - it is purely informational.
|
|
14
|
+
*/
|
|
15
|
+
function deprecate({ id, subject, replacement }) {
|
|
16
|
+
if (warned.has(id)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
warned.add(id);
|
|
20
|
+
process.emitWarning(`${subject} is deprecated and will be removed in OpenComponents v1 - use ${replacement} instead.`, 'DeprecationWarning');
|
|
21
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oc",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.60",
|
|
4
4
|
"description": "A framework for developing and distributing html components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@biomejs/biome": "^2.5.0",
|
|
41
41
|
"@types/accept-language-parser": "^1.5.8",
|
|
42
|
-
"@types/async": "^3.2.25",
|
|
43
42
|
"@types/bun": "^1.3.14",
|
|
44
43
|
"@types/cookie-parser": "^1.4.10",
|
|
45
44
|
"@types/cross-spawn": "^6.0.6",
|
|
@@ -74,11 +73,9 @@
|
|
|
74
73
|
"@rdevis/turbo-stream": "^2.4.1",
|
|
75
74
|
"@types/lodash.isequal": "^4.5.8",
|
|
76
75
|
"accept-language-parser": "^1.5.0",
|
|
77
|
-
"async": "^3.2.6",
|
|
78
76
|
"basic-auth-connect": "^1.1.0",
|
|
79
77
|
"builtin-modules": "^3.3.0",
|
|
80
78
|
"chokidar": "^4.0.3",
|
|
81
|
-
"colors": "^1.4.0",
|
|
82
79
|
"cookie-parser": "^1.4.7",
|
|
83
80
|
"cross-spawn": "^7.0.6",
|
|
84
81
|
"dependency-graph": "^1.0.0",
|
|
@@ -92,14 +89,14 @@
|
|
|
92
89
|
"livereload": "^0.10.3",
|
|
93
90
|
"lodash.isequal": "^4.5.0",
|
|
94
91
|
"morgan": "^1.11.0",
|
|
95
|
-
"multer": "^2.0
|
|
92
|
+
"multer": "^2.2.0",
|
|
96
93
|
"nice-cache": "^0.0.5",
|
|
97
94
|
"oc-client": "^4.0.3",
|
|
98
|
-
"oc-client-browser": "^2.1.
|
|
95
|
+
"oc-client-browser": "^2.1.12",
|
|
99
96
|
"oc-empty-response-handler": "^1.0.2",
|
|
100
97
|
"oc-get-unix-utc-timestamp": "^1.0.6",
|
|
101
98
|
"oc-metadata-adapters-utils": "^0.1.1",
|
|
102
|
-
"oc-s3-storage-adapter": "^2.2.
|
|
99
|
+
"oc-s3-storage-adapter": "^2.2.4",
|
|
103
100
|
"oc-storage-adapters-utils": "^2.1.2",
|
|
104
101
|
"oc-template-es6": "^2.0.0",
|
|
105
102
|
"oc-template-es6-compiler": "^7.1.4",
|
|
@@ -109,6 +106,7 @@
|
|
|
109
106
|
"oc-template-jade-compiler": "^7.5.0",
|
|
110
107
|
"open": "^10.2.0",
|
|
111
108
|
"parse-author": "^2.0.0",
|
|
109
|
+
"picocolors": "^1.1.1",
|
|
112
110
|
"read": "^1.0.7",
|
|
113
111
|
"require-package-name": "^2.0.1",
|
|
114
112
|
"response-time": "^2.3.4",
|