@embeddable.com/sdk-react 2.2.0 → 2.2.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.
@@ -1,10 +1,9 @@
1
1
  import { ModuleInfo } from "rollup";
2
- declare const _default: ({ globalKey, outputDir, fileName, componentFileRegex, typeFileRegex, searchEntry, }: {
2
+ declare const _default: ({ globalKey, outputDir, fileName, componentFileRegex, searchEntry, }: {
3
3
  globalKey: string;
4
4
  outputDir: string;
5
5
  fileName: string;
6
6
  componentFileRegex: RegExp;
7
- typeFileRegex: RegExp;
8
7
  searchEntry?: string | undefined;
9
8
  }) => {
10
9
  name: string;
package/lib/index.esm.js CHANGED
@@ -10,6 +10,8 @@ import { parse } from '@babel/parser';
10
10
  import generator from '@babel/generator';
11
11
  import traverse from '@babel/traverse';
12
12
  import 'node:child_process';
13
+ import { z } from 'zod';
14
+ import { ALL_NATIVE_TYPES } from '@embeddable.com/core';
13
15
 
14
16
  var createContext = (pluginRoot, coreCtx) => {
15
17
  coreCtx["sdk-react"] = {
@@ -23,16 +25,42 @@ var createContext = (pluginRoot, coreCtx) => {
23
25
  };
24
26
  };
25
27
 
26
- /**
27
- * TODO: for some reason code from @embeddable.com/extract-components-config
28
- * is being cached. Thus we use this code duplication in place. Please investigate and fix.
29
- */
30
28
  // @ts-ignore
31
29
  const babelTraverse = traverse.default;
32
30
  // @ts-ignore
33
31
  const babelGenerate = generator.default;
34
32
  const CORE_TYPES_IMPORT_REGEX = /@embeddable\.com\/core$/;
35
- var extractComponentsConfigPlugin = ({ globalKey, outputDir, fileName, componentFileRegex, typeFileRegex, searchEntry = "", }) => {
33
+ const EMB_TYPE_FILE_REGEX = /^(.*)\.type\.emb\.[jt]s$/;
34
+ const loadComponentMeta = async (moduleId, code) => {
35
+ const ast = parse(code, {
36
+ sourceType: "module",
37
+ });
38
+ babelTraverse(ast, {
39
+ ImportDeclaration: (path) => {
40
+ const isNativeTypesImport = CORE_TYPES_IMPORT_REGEX.test(path.node.source.value);
41
+ const isCustomTypeImport = EMB_TYPE_FILE_REGEX.test(path.node.source.value);
42
+ if (!(isNativeTypesImport || isCustomTypeImport)) {
43
+ path.remove();
44
+ }
45
+ },
46
+ ExportDefaultDeclaration: (path) => {
47
+ path.remove();
48
+ },
49
+ });
50
+ const tempFilePath = moduleId
51
+ .replace(".emb.", ".emb-temp.")
52
+ .replace(/\.ts$/, ".js");
53
+ await fs.writeFile(tempFilePath, babelGenerate(ast).code);
54
+ const module = await import(tempFilePath);
55
+ await fs.rm(tempFilePath);
56
+ return module.meta;
57
+ };
58
+
59
+ /**
60
+ * TODO: for some reason code from @embeddable.com/extract-components-config
61
+ * is being cached. Thus we use this code duplication in place. Please investigate and fix.
62
+ */
63
+ var extractComponentsConfigPlugin = ({ globalKey, outputDir, fileName, componentFileRegex, searchEntry = "", }) => {
36
64
  const configs = [];
37
65
  return {
38
66
  name: "extract-components-config",
@@ -40,32 +68,12 @@ var extractComponentsConfigPlugin = ({ globalKey, outputDir, fileName, component
40
68
  var _a;
41
69
  if (componentFileRegex.test(moduleInfo.id) &&
42
70
  ((_a = moduleInfo.code) === null || _a === void 0 ? void 0 : _a.includes(searchEntry))) {
43
- const ast = parse(moduleInfo.code, {
44
- sourceType: "module",
45
- });
46
- babelTraverse(ast, {
47
- ImportDeclaration: (path) => {
48
- const isNativeTypesImport = CORE_TYPES_IMPORT_REGEX.test(path.node.source.value);
49
- const isCustomTypeImport = typeFileRegex.test(path.node.source.value);
50
- if (!(isNativeTypesImport || isCustomTypeImport)) {
51
- path.remove();
52
- }
53
- },
54
- ExportDefaultDeclaration: (path) => {
55
- path.remove();
56
- },
57
- });
58
- const tempFilePath = moduleInfo.id
59
- .replace(".emb.", ".emb-temp.")
60
- .replace(/\.ts$/, ".js");
61
- await fs.writeFile(tempFilePath, babelGenerate(ast).code);
62
- const module = await import(tempFilePath);
63
- const configJSON = JSON.stringify(module.meta, (_key, value) => typeof value === "object" &&
71
+ const meta = await loadComponentMeta(moduleInfo.id, moduleInfo.code);
72
+ const configJSON = JSON.stringify(meta, (_key, value) => typeof value === "object" &&
64
73
  value !== null &&
65
74
  "__embeddableType" in value
66
75
  ? value.toString()
67
76
  : value);
68
- await fs.rm(tempFilePath);
69
77
  configs.push(configJSON);
70
78
  }
71
79
  },
@@ -101,9 +109,511 @@ var findFiles = async (initialSrcDir, regex) => {
101
109
  return filesList;
102
110
  };
103
111
 
112
+ var util;
113
+ (function (util) {
114
+ util.assertEqual = (val) => val;
115
+ function assertIs(_arg) { }
116
+ util.assertIs = assertIs;
117
+ function assertNever(_x) {
118
+ throw new Error();
119
+ }
120
+ util.assertNever = assertNever;
121
+ util.arrayToEnum = (items) => {
122
+ const obj = {};
123
+ for (const item of items) {
124
+ obj[item] = item;
125
+ }
126
+ return obj;
127
+ };
128
+ util.getValidEnumValues = (obj) => {
129
+ const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
130
+ const filtered = {};
131
+ for (const k of validKeys) {
132
+ filtered[k] = obj[k];
133
+ }
134
+ return util.objectValues(filtered);
135
+ };
136
+ util.objectValues = (obj) => {
137
+ return util.objectKeys(obj).map(function (e) {
138
+ return obj[e];
139
+ });
140
+ };
141
+ util.objectKeys = typeof Object.keys === "function" // eslint-disable-line ban/ban
142
+ ? (obj) => Object.keys(obj) // eslint-disable-line ban/ban
143
+ : (object) => {
144
+ const keys = [];
145
+ for (const key in object) {
146
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
147
+ keys.push(key);
148
+ }
149
+ }
150
+ return keys;
151
+ };
152
+ util.find = (arr, checker) => {
153
+ for (const item of arr) {
154
+ if (checker(item))
155
+ return item;
156
+ }
157
+ return undefined;
158
+ };
159
+ util.isInteger = typeof Number.isInteger === "function"
160
+ ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
161
+ : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
162
+ function joinValues(array, separator = " | ") {
163
+ return array
164
+ .map((val) => (typeof val === "string" ? `'${val}'` : val))
165
+ .join(separator);
166
+ }
167
+ util.joinValues = joinValues;
168
+ util.jsonStringifyReplacer = (_, value) => {
169
+ if (typeof value === "bigint") {
170
+ return value.toString();
171
+ }
172
+ return value;
173
+ };
174
+ })(util || (util = {}));
175
+ var objectUtil;
176
+ (function (objectUtil) {
177
+ objectUtil.mergeShapes = (first, second) => {
178
+ return {
179
+ ...first,
180
+ ...second, // second overwrites first
181
+ };
182
+ };
183
+ })(objectUtil || (objectUtil = {}));
184
+ util.arrayToEnum([
185
+ "string",
186
+ "nan",
187
+ "number",
188
+ "integer",
189
+ "float",
190
+ "boolean",
191
+ "date",
192
+ "bigint",
193
+ "symbol",
194
+ "function",
195
+ "undefined",
196
+ "null",
197
+ "array",
198
+ "object",
199
+ "unknown",
200
+ "promise",
201
+ "void",
202
+ "never",
203
+ "map",
204
+ "set",
205
+ ]);
206
+
207
+ const ZodIssueCode = util.arrayToEnum([
208
+ "invalid_type",
209
+ "invalid_literal",
210
+ "custom",
211
+ "invalid_union",
212
+ "invalid_union_discriminator",
213
+ "invalid_enum_value",
214
+ "unrecognized_keys",
215
+ "invalid_arguments",
216
+ "invalid_return_type",
217
+ "invalid_date",
218
+ "invalid_string",
219
+ "too_small",
220
+ "too_big",
221
+ "invalid_intersection_types",
222
+ "not_multiple_of",
223
+ "not_finite",
224
+ ]);
225
+ class ZodError extends Error {
226
+ constructor(issues) {
227
+ super();
228
+ this.issues = [];
229
+ this.addIssue = (sub) => {
230
+ this.issues = [...this.issues, sub];
231
+ };
232
+ this.addIssues = (subs = []) => {
233
+ this.issues = [...this.issues, ...subs];
234
+ };
235
+ const actualProto = new.target.prototype;
236
+ if (Object.setPrototypeOf) {
237
+ // eslint-disable-next-line ban/ban
238
+ Object.setPrototypeOf(this, actualProto);
239
+ }
240
+ else {
241
+ this.__proto__ = actualProto;
242
+ }
243
+ this.name = "ZodError";
244
+ this.issues = issues;
245
+ }
246
+ get errors() {
247
+ return this.issues;
248
+ }
249
+ format(_mapper) {
250
+ const mapper = _mapper ||
251
+ function (issue) {
252
+ return issue.message;
253
+ };
254
+ const fieldErrors = { _errors: [] };
255
+ const processError = (error) => {
256
+ for (const issue of error.issues) {
257
+ if (issue.code === "invalid_union") {
258
+ issue.unionErrors.map(processError);
259
+ }
260
+ else if (issue.code === "invalid_return_type") {
261
+ processError(issue.returnTypeError);
262
+ }
263
+ else if (issue.code === "invalid_arguments") {
264
+ processError(issue.argumentsError);
265
+ }
266
+ else if (issue.path.length === 0) {
267
+ fieldErrors._errors.push(mapper(issue));
268
+ }
269
+ else {
270
+ let curr = fieldErrors;
271
+ let i = 0;
272
+ while (i < issue.path.length) {
273
+ const el = issue.path[i];
274
+ const terminal = i === issue.path.length - 1;
275
+ if (!terminal) {
276
+ curr[el] = curr[el] || { _errors: [] };
277
+ // if (typeof el === "string") {
278
+ // curr[el] = curr[el] || { _errors: [] };
279
+ // } else if (typeof el === "number") {
280
+ // const errorArray: any = [];
281
+ // errorArray._errors = [];
282
+ // curr[el] = curr[el] || errorArray;
283
+ // }
284
+ }
285
+ else {
286
+ curr[el] = curr[el] || { _errors: [] };
287
+ curr[el]._errors.push(mapper(issue));
288
+ }
289
+ curr = curr[el];
290
+ i++;
291
+ }
292
+ }
293
+ }
294
+ };
295
+ processError(this);
296
+ return fieldErrors;
297
+ }
298
+ toString() {
299
+ return this.message;
300
+ }
301
+ get message() {
302
+ return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
303
+ }
304
+ get isEmpty() {
305
+ return this.issues.length === 0;
306
+ }
307
+ flatten(mapper = (issue) => issue.message) {
308
+ const fieldErrors = {};
309
+ const formErrors = [];
310
+ for (const sub of this.issues) {
311
+ if (sub.path.length > 0) {
312
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
313
+ fieldErrors[sub.path[0]].push(mapper(sub));
314
+ }
315
+ else {
316
+ formErrors.push(mapper(sub));
317
+ }
318
+ }
319
+ return { formErrors, fieldErrors };
320
+ }
321
+ get formErrors() {
322
+ return this.flatten();
323
+ }
324
+ }
325
+ ZodError.create = (issues) => {
326
+ const error = new ZodError(issues);
327
+ return error;
328
+ };
329
+
330
+ var errorUtil;
331
+ (function (errorUtil) {
332
+ errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
333
+ errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
334
+ })(errorUtil || (errorUtil = {}));
335
+ var ZodFirstPartyTypeKind;
336
+ (function (ZodFirstPartyTypeKind) {
337
+ ZodFirstPartyTypeKind["ZodString"] = "ZodString";
338
+ ZodFirstPartyTypeKind["ZodNumber"] = "ZodNumber";
339
+ ZodFirstPartyTypeKind["ZodNaN"] = "ZodNaN";
340
+ ZodFirstPartyTypeKind["ZodBigInt"] = "ZodBigInt";
341
+ ZodFirstPartyTypeKind["ZodBoolean"] = "ZodBoolean";
342
+ ZodFirstPartyTypeKind["ZodDate"] = "ZodDate";
343
+ ZodFirstPartyTypeKind["ZodSymbol"] = "ZodSymbol";
344
+ ZodFirstPartyTypeKind["ZodUndefined"] = "ZodUndefined";
345
+ ZodFirstPartyTypeKind["ZodNull"] = "ZodNull";
346
+ ZodFirstPartyTypeKind["ZodAny"] = "ZodAny";
347
+ ZodFirstPartyTypeKind["ZodUnknown"] = "ZodUnknown";
348
+ ZodFirstPartyTypeKind["ZodNever"] = "ZodNever";
349
+ ZodFirstPartyTypeKind["ZodVoid"] = "ZodVoid";
350
+ ZodFirstPartyTypeKind["ZodArray"] = "ZodArray";
351
+ ZodFirstPartyTypeKind["ZodObject"] = "ZodObject";
352
+ ZodFirstPartyTypeKind["ZodUnion"] = "ZodUnion";
353
+ ZodFirstPartyTypeKind["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
354
+ ZodFirstPartyTypeKind["ZodIntersection"] = "ZodIntersection";
355
+ ZodFirstPartyTypeKind["ZodTuple"] = "ZodTuple";
356
+ ZodFirstPartyTypeKind["ZodRecord"] = "ZodRecord";
357
+ ZodFirstPartyTypeKind["ZodMap"] = "ZodMap";
358
+ ZodFirstPartyTypeKind["ZodSet"] = "ZodSet";
359
+ ZodFirstPartyTypeKind["ZodFunction"] = "ZodFunction";
360
+ ZodFirstPartyTypeKind["ZodLazy"] = "ZodLazy";
361
+ ZodFirstPartyTypeKind["ZodLiteral"] = "ZodLiteral";
362
+ ZodFirstPartyTypeKind["ZodEnum"] = "ZodEnum";
363
+ ZodFirstPartyTypeKind["ZodEffects"] = "ZodEffects";
364
+ ZodFirstPartyTypeKind["ZodNativeEnum"] = "ZodNativeEnum";
365
+ ZodFirstPartyTypeKind["ZodOptional"] = "ZodOptional";
366
+ ZodFirstPartyTypeKind["ZodNullable"] = "ZodNullable";
367
+ ZodFirstPartyTypeKind["ZodDefault"] = "ZodDefault";
368
+ ZodFirstPartyTypeKind["ZodCatch"] = "ZodCatch";
369
+ ZodFirstPartyTypeKind["ZodPromise"] = "ZodPromise";
370
+ ZodFirstPartyTypeKind["ZodBranded"] = "ZodBranded";
371
+ ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
372
+ ZodFirstPartyTypeKind["ZodReadonly"] = "ZodReadonly";
373
+ })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
374
+
375
+ const errorFormatter = (issues) => {
376
+ const errors = [];
377
+ for (let issue of issues) {
378
+ if (issue.code === ZodIssueCode.invalid_union && issue.unionErrors.length) {
379
+ const error = issue.unionErrors[issue.unionErrors.length - 1];
380
+ issue = error.issues[error.issues.length - 1];
381
+ }
382
+ const path = formatErrorPath(issue.path);
383
+ const message = issue.message;
384
+ errors.push(`"${path}": ${message}`);
385
+ }
386
+ return errors;
387
+ };
388
+ const formatErrorPath = (path) => {
389
+ let formatted = "";
390
+ for (const pathElement of path) {
391
+ if (formatted.length === 0) {
392
+ formatted = `${pathElement}`;
393
+ }
394
+ else {
395
+ formatted +=
396
+ typeof pathElement === "number"
397
+ ? `[${pathElement}]`
398
+ : `.${pathElement}`;
399
+ }
400
+ }
401
+ return formatted;
402
+ };
403
+
404
+ const embeddableTypeSchema = z
405
+ .object({
406
+ typeConfig: z.object({
407
+ label: z.string(),
408
+ toString: z.function(),
409
+ }),
410
+ })
411
+ .or(z.enum(ALL_NATIVE_TYPES));
412
+
413
+ const editorMetaSchema = z
414
+ .object({
415
+ name: z.string(),
416
+ label: z.string(),
417
+ type: embeddableTypeSchema,
418
+ })
419
+ .strict();
420
+
421
+ const editorMetaValidator = (meta) => {
422
+ const result = editorMetaSchema.safeParse(meta);
423
+ if (result.success)
424
+ return [];
425
+ return errorFormatter(result.error.issues);
426
+ };
427
+
428
+ const componentMetaSchema = z
429
+ .object({
430
+ name: z.string(),
431
+ label: z.string(),
432
+ inputs: z
433
+ .object({
434
+ name: z.string(),
435
+ label: z.string(),
436
+ description: z.string().optional(),
437
+ defaultValue: z.any().optional(),
438
+ config: z.record(z.string(), z.any()).optional(),
439
+ type: embeddableTypeSchema,
440
+ array: z.boolean().optional(),
441
+ })
442
+ .strict()
443
+ .array()
444
+ .optional(),
445
+ events: z
446
+ .object({
447
+ name: z.string(),
448
+ label: z.string(),
449
+ properties: z
450
+ .object({
451
+ name: z.string(),
452
+ type: embeddableTypeSchema,
453
+ label: z.string().optional(),
454
+ })
455
+ .array()
456
+ .optional(),
457
+ })
458
+ .strict()
459
+ .array()
460
+ .optional(),
461
+ variables: z
462
+ .object({
463
+ name: z.string(),
464
+ type: embeddableTypeSchema,
465
+ defaultValue: z.any().optional(),
466
+ inputs: z.array(z.string()).optional(),
467
+ events: z
468
+ .array(z.object({
469
+ name: z.string(),
470
+ property: z.string(),
471
+ }))
472
+ .optional(),
473
+ })
474
+ .strict()
475
+ .array()
476
+ .optional(),
477
+ })
478
+ .strict();
479
+
480
+ const componentMetaValidator = (meta) => {
481
+ const result = componentMetaSchema.safeParse(meta);
482
+ if (!result.success)
483
+ return errorFormatter(result.error.issues);
484
+ return validateVariables(meta);
485
+ };
486
+ const validateVariables = (meta) => {
487
+ const variables = meta.variables;
488
+ if (!variables)
489
+ return [];
490
+ const errors = [];
491
+ // all inputs should be defined
492
+ errors.push(...validateVariableInputs(meta));
493
+ // all events and properties should be valid
494
+ errors.push(...validateVariableEvents(meta));
495
+ return errors;
496
+ };
497
+ const validateVariableInputs = (meta) => {
498
+ const variables = meta.variables;
499
+ const definedInputs = meta.inputs;
500
+ if (!variables)
501
+ return [];
502
+ const errors = [];
503
+ // all inputs should be defined
504
+ variables.forEach((variableConfig, idx) => {
505
+ const inputs = variableConfig.inputs;
506
+ if (inputs) {
507
+ inputs.forEach((input, inputIdx) => {
508
+ const definedInput = definedInputs === null || definedInputs === void 0 ? void 0 : definedInputs.find((d) => d.name === input);
509
+ if (!definedInput) {
510
+ const path = formatErrorPath(["variables", idx, "inputs", inputIdx]);
511
+ errors.push(`${path}: input "${input}" is not defined`);
512
+ }
513
+ });
514
+ }
515
+ });
516
+ return errors;
517
+ };
518
+ const validateVariableEvents = (meta) => {
519
+ const variables = meta.variables;
520
+ const definedEvents = meta.events;
521
+ if (!variables)
522
+ return [];
523
+ const errors = [];
524
+ variables.forEach((variableConfig, idx) => {
525
+ const events = variableConfig.events;
526
+ if (events) {
527
+ events.forEach((event, eventIdx) => {
528
+ const definedEvent = definedEvents === null || definedEvents === void 0 ? void 0 : definedEvents.find((d) => d.name === event.name);
529
+ if (!definedEvent) {
530
+ const path = formatErrorPath([
531
+ "variables",
532
+ idx,
533
+ "events",
534
+ eventIdx,
535
+ "name",
536
+ ]);
537
+ errors.push(`${path}: event "${event.name}" is not defined`);
538
+ return;
539
+ }
540
+ const definedProperties = definedEvent.properties;
541
+ const definedProperty = definedProperties === null || definedProperties === void 0 ? void 0 : definedProperties.find((p) => p.name === event.property);
542
+ if (!definedProperty) {
543
+ const path = formatErrorPath([
544
+ "variables",
545
+ idx,
546
+ "events",
547
+ eventIdx,
548
+ "property",
549
+ ]);
550
+ errors.push(`${path}: property "${event.property}" is not defined`);
551
+ return;
552
+ }
553
+ if (definedProperty.type !== variableConfig.type) {
554
+ const path = formatErrorPath(["variables", idx]);
555
+ errors.push(`${path}: the type of the variable "${variableConfig.name}" and the type of the property "${event.property}" do not match`);
556
+ }
557
+ });
558
+ }
559
+ });
560
+ return errors;
561
+ };
562
+
563
+ const EDITOR = "editor";
564
+ const COMPONENT = "component";
565
+ const validators = {
566
+ [EDITOR]: editorMetaValidator,
567
+ [COMPONENT]: componentMetaValidator,
568
+ };
569
+ const getModuleType = (moduleInfo) => {
570
+ var _a, _b;
571
+ if ((_a = moduleInfo.code) === null || _a === void 0 ? void 0 : _a.includes("defineComponent")) {
572
+ return COMPONENT;
573
+ }
574
+ else if ((_b = moduleInfo.code) === null || _b === void 0 ? void 0 : _b.includes("defineEditor")) {
575
+ return EDITOR;
576
+ }
577
+ else {
578
+ return null;
579
+ }
580
+ };
581
+ var validateComponentMetaPlugin = (componentFileRegex) => {
582
+ const metaConfigs = [];
583
+ return {
584
+ name: "validate-component-meta",
585
+ moduleParsed: async (moduleInfo) => {
586
+ const moduleType = componentFileRegex.test(moduleInfo.id)
587
+ ? getModuleType(moduleInfo)
588
+ : null;
589
+ if (moduleType) {
590
+ const meta = await loadComponentMeta(moduleInfo.id, moduleInfo.code);
591
+ metaConfigs.push({
592
+ moduleId: moduleInfo.id,
593
+ meta,
594
+ moduleType,
595
+ });
596
+ }
597
+ },
598
+ buildEnd: function () {
599
+ const errors = [];
600
+ for (const metaConfig of metaConfigs) {
601
+ const validator = validators[metaConfig.moduleType];
602
+ const validationResult = validator(metaConfig.meta);
603
+ if (validationResult && validationResult.length) {
604
+ errors.push(`\nComponent meta is not valid ${metaConfig.moduleId}:\n${validationResult.join("\n")}`);
605
+ }
606
+ }
607
+ if (errors.length) {
608
+ // @ts-ignore
609
+ this.error(errors.join("\n"));
610
+ }
611
+ },
612
+ };
613
+ };
614
+
104
615
  const oraP = import('ora');
105
616
  const EMB_FILE_REGEX = /^(.*)(?<!\.type|\.options)\.emb\.[jt]s$/;
106
- const EMB_TYPE_FILE_REGEX = /^(.*)\.type\.emb\.[jt]s$/;
107
617
  var generate = async (ctx) => {
108
618
  const ora = (await oraP).default;
109
619
  const progress = ora("React: building components...").start();
@@ -123,7 +633,6 @@ async function runViteBuild(ctx) {
123
633
  fileName: "embeddable-components-meta.js",
124
634
  outputDir: ".embeddable-build",
125
635
  componentFileRegex: EMB_FILE_REGEX,
126
- typeFileRegex: EMB_TYPE_FILE_REGEX,
127
636
  searchEntry: "defineComponent",
128
637
  }),
129
638
  extractComponentsConfigPlugin({
@@ -131,9 +640,9 @@ async function runViteBuild(ctx) {
131
640
  fileName: "embeddable-editors-meta.js",
132
641
  outputDir: ".embeddable-build",
133
642
  componentFileRegex: EMB_FILE_REGEX,
134
- typeFileRegex: EMB_TYPE_FILE_REGEX,
135
643
  searchEntry: "defineEditor",
136
644
  }),
645
+ validateComponentMetaPlugin(EMB_FILE_REGEX),
137
646
  ],
138
647
  build: {
139
648
  sourcemap: true,