@embeddable.com/sdk-react 0.0.15 → 0.0.16

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.
@@ -9,7 +9,7 @@ export type EmbeddableEvent<T> = {
9
9
  value: T;
10
10
  };
11
11
  type Setter<T> = (value: T) => void;
12
- export declare function embedEditor<T>(InnerComponent: React.ComponentType, config: Config<T>): {
12
+ export declare function embedControl<T>(InnerComponent: React.ComponentType, config: Config<T>): {
13
13
  ({ editorId, initialValue }: {
14
14
  editorId: any;
15
15
  initialValue: any;
package/lib/index.cjs.js CHANGED
@@ -88,7 +88,7 @@ function embedComponent(InnerComponent, config) {
88
88
  }
89
89
 
90
90
  var EVENT_NAME = "embeddable:editor:changed";
91
- function embedEditor(InnerComponent, config) {
91
+ function embedControl(InnerComponent, config) {
92
92
  var _a;
93
93
  function EmbeddableWrapper(_a) {
94
94
  var editorId = _a.editorId, initialValue = _a.initialValue;
@@ -124,4 +124,4 @@ function embedEditor(InnerComponent, config) {
124
124
  }
125
125
 
126
126
  exports.embedComponent = embedComponent;
127
- exports.embedEditor = embedEditor;
127
+ exports.embedControl = embedControl;
package/lib/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { embedComponent } from './embedComponent';
2
- export { embedEditor } from './embedEditor';
2
+ export { embedControl } from './embedControl';
package/lib/index.esm.js CHANGED
@@ -67,7 +67,7 @@ function embedComponent(InnerComponent, config) {
67
67
  }
68
68
 
69
69
  var EVENT_NAME = "embeddable:editor:changed";
70
- function embedEditor(InnerComponent, config) {
70
+ function embedControl(InnerComponent, config) {
71
71
  var _a;
72
72
  function EmbeddableWrapper(_a) {
73
73
  var editorId = _a.editorId, initialValue = _a.initialValue;
@@ -102,4 +102,4 @@ function embedEditor(InnerComponent, config) {
102
102
  return EmbeddableWrapper;
103
103
  }
104
104
 
105
- export { embedComponent, embedEditor };
105
+ export { embedComponent, embedControl };
package/lib/index.umd.js CHANGED
@@ -108,7 +108,7 @@
108
108
  }
109
109
 
110
110
  var EVENT_NAME = "embeddable:editor:changed";
111
- function embedEditor(InnerComponent, config) {
111
+ function embedControl(InnerComponent, config) {
112
112
  var _a;
113
113
  function EmbeddableWrapper(_a) {
114
114
  var editorId = _a.editorId, initialValue = _a.initialValue;
@@ -144,6 +144,6 @@
144
144
  }
145
145
 
146
146
  exports.embedComponent = embedComponent;
147
- exports.embedEditor = embedEditor;
147
+ exports.embedControl = embedControl;
148
148
 
149
149
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embeddable.com/sdk-react",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "description": "Embeddable SDK React plugin/module responsible for React components bundling.",
5
5
  "keywords": [
6
6
  "embeddable",
@@ -2,7 +2,7 @@ const fs = require("fs/promises");
2
2
  const path = require("path");
3
3
  const vite = require("vite");
4
4
  const viteReactPlugin = require('@vitejs/plugin-react');
5
- const core = require("@embeddable.com/sdk-core/scripts/build");
5
+ const core = require("@embeddable.com/sdk-core/scripts");
6
6
 
7
7
  process.on('message', async ({ ctx }) => {
8
8
  await generate(ctx);
@@ -10,8 +10,10 @@ process.on('message', async ({ ctx }) => {
10
10
  process.exit();
11
11
  });
12
12
 
13
+ const EMB_FILE_REGEX = /^(.*)\.emb\.[jt]s$/;
14
+
13
15
  async function generate(ctx) {
14
- const filesList = await findEmbFiles(ctx.client.srcDir);
16
+ const filesList = await core.findEmbFiles(ctx.client.srcDir, EMB_FILE_REGEX);
15
17
 
16
18
  await injectImports(ctx, filesList);
17
19
 
@@ -65,35 +67,3 @@ async function injectImports(ctx, filesList) {
65
67
  content.replace(REPLACE_TOKEN, imports)
66
68
  );
67
69
  }
68
-
69
-
70
- const EMB_FILE_REGEX = /^(.*)\.emb\.(j|t)s$/;
71
-
72
- async function findEmbFiles (initialSrcDir) {
73
- const filesList = [];
74
-
75
- async function findEmbFilesRec(srcDir) {
76
- const allFiles = await fs.readdir(srcDir);
77
-
78
- for (const file of allFiles) {
79
- const filePath = path.join(srcDir, file)
80
-
81
- const status = await fs.lstat(filePath);
82
-
83
- if (status.isDirectory()) {
84
- await findEmbFilesRec(filePath)
85
- }
86
-
87
- const fileName = file.match(EMB_FILE_REGEX);
88
-
89
- if (fileName) {
90
- filesList.push([fileName[1], filePath]);
91
- }
92
- }
93
- }
94
-
95
- await findEmbFilesRec(initialSrcDir);
96
-
97
-
98
- return filesList;
99
- }