@embeddable.com/sdk-core 3.14.7-next.2 → 4.0.0-next.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/lib/index.esm.js +16 -53
- package/lib/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/buildTypes.test.ts +0 -46
- package/src/buildTypes.ts +0 -3
- package/src/defineConfig.test.ts +7 -7
- package/src/dev.test.ts +41 -1529
- package/src/dev.ts +12 -54
- package/src/push.test.ts +7 -7
- package/src/push.ts +20 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embeddable.com/sdk-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-next.0",
|
|
4
4
|
"description": "Core Embeddable SDK module responsible for web-components bundling and publishing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"embeddable",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@embeddable.com/core": "2.10.4",
|
|
44
|
-
"@embeddable.com/sdk-utils": "0.8.
|
|
44
|
+
"@embeddable.com/sdk-utils": "0.8.0",
|
|
45
45
|
"@inquirer/prompts": "^7.2.1",
|
|
46
46
|
"@stencil/core": "^4.23.0",
|
|
47
47
|
"@swc-node/register": "^1.10.9",
|
package/src/buildTypes.test.ts
CHANGED
|
@@ -101,9 +101,6 @@ describe("buildTypes", () => {
|
|
|
101
101
|
expect(build).toHaveBeenCalledWith({
|
|
102
102
|
build: {
|
|
103
103
|
emptyOutDir: false,
|
|
104
|
-
sourcemap: true,
|
|
105
|
-
minify: true,
|
|
106
|
-
rollupOptions: undefined,
|
|
107
104
|
lib: {
|
|
108
105
|
entry: "resolvedPath",
|
|
109
106
|
fileName: "embeddable-types",
|
|
@@ -137,49 +134,6 @@ import '../relativePath';`,
|
|
|
137
134
|
expect(getContentHash).not.toHaveBeenCalled();
|
|
138
135
|
expect(fs.rename).not.toHaveBeenCalled();
|
|
139
136
|
});
|
|
140
|
-
|
|
141
|
-
it("should use dev optimizations when watch mode is enabled", async () => {
|
|
142
|
-
await buildTypes({
|
|
143
|
-
...config,
|
|
144
|
-
dev: { watch: true, logger: undefined, sys: undefined },
|
|
145
|
-
} as unknown as ResolvedEmbeddableConfig);
|
|
146
|
-
|
|
147
|
-
expect(build).toHaveBeenCalledWith({
|
|
148
|
-
build: {
|
|
149
|
-
emptyOutDir: false,
|
|
150
|
-
sourcemap: false,
|
|
151
|
-
minify: false,
|
|
152
|
-
rollupOptions: { treeshake: false },
|
|
153
|
-
lib: {
|
|
154
|
-
entry: "resolvedPath",
|
|
155
|
-
fileName: "embeddable-types",
|
|
156
|
-
formats: ["es"],
|
|
157
|
-
},
|
|
158
|
-
outDir: "build",
|
|
159
|
-
},
|
|
160
|
-
logLevel: "error",
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
it("should rename the built file with hash when not in watch mode", async () => {
|
|
165
|
-
// Reset the mock to control it better
|
|
166
|
-
vi.mocked(path.resolve).mockReset();
|
|
167
|
-
|
|
168
|
-
// Mock the calls in order they happen
|
|
169
|
-
vi.mocked(path.resolve)
|
|
170
|
-
.mockReturnValueOnce("resolvedPath") // typesFilePath in build()
|
|
171
|
-
.mockReturnValueOnce("resolvedPath") // typesFilePath for readFile
|
|
172
|
-
.mockReturnValueOnce("build/embeddable-types.js") // source file for rename
|
|
173
|
-
.mockReturnValueOnce("build/embeddable-types-somehash.js"); // target file for rename
|
|
174
|
-
|
|
175
|
-
await buildTypes(config as unknown as ResolvedEmbeddableConfig);
|
|
176
|
-
|
|
177
|
-
expect(fs.rename).toHaveBeenCalledWith(
|
|
178
|
-
"build/embeddable-types.js",
|
|
179
|
-
"build/embeddable-types-somehash.js"
|
|
180
|
-
);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
137
|
it("should import types from installed libraries if present", async () => {
|
|
184
138
|
const configWithLibrary = {
|
|
185
139
|
...config,
|
package/src/buildTypes.ts
CHANGED
|
@@ -66,9 +66,6 @@ async function build(ctx: ResolvedEmbeddableConfig) {
|
|
|
66
66
|
logLevel: "error",
|
|
67
67
|
build: {
|
|
68
68
|
emptyOutDir: false,
|
|
69
|
-
sourcemap: ctx.dev?.watch ? (false as const) : true, // No sourcemaps for types in dev
|
|
70
|
-
minify: !ctx.dev?.watch, // No minification in dev
|
|
71
|
-
rollupOptions: ctx.dev?.watch ? { treeshake: false } : undefined,
|
|
72
69
|
lib: {
|
|
73
70
|
entry: typesFilePath,
|
|
74
71
|
formats: ["es"],
|
package/src/defineConfig.test.ts
CHANGED
|
@@ -35,7 +35,7 @@ describe("defineConfig", () => {
|
|
|
35
35
|
vi.mocked(path.resolve).mockReturnValue(coreRoot);
|
|
36
36
|
|
|
37
37
|
vi.spyOn(process, "cwd").mockReturnValue(
|
|
38
|
-
"/embeddable-sdk/packages/core-sdk"
|
|
38
|
+
"/embeddable-sdk/packages/core-sdk"
|
|
39
39
|
);
|
|
40
40
|
});
|
|
41
41
|
|
|
@@ -94,17 +94,17 @@ describe("defineConfig", () => {
|
|
|
94
94
|
|
|
95
95
|
it("throws error for invalid property", () => {
|
|
96
96
|
expect(() =>
|
|
97
|
-
defineConfig({ plugins: [], invalidProp: "INVALID" as any } as any)
|
|
97
|
+
defineConfig({ plugins: [], invalidProp: "INVALID" as any } as any)
|
|
98
98
|
).toThrow(
|
|
99
|
-
`Invalid Embeddable Configuration: "": Unrecognized key(s) in object: 'invalidProp'}
|
|
99
|
+
`Invalid Embeddable Configuration: "": Unrecognized key(s) in object: 'invalidProp'}`
|
|
100
100
|
);
|
|
101
101
|
});
|
|
102
102
|
|
|
103
103
|
it("throws error for invalid property value", () => {
|
|
104
104
|
expect(() =>
|
|
105
|
-
defineConfig({ plugins: [], pushBaseUrl: 123 as any } as any)
|
|
105
|
+
defineConfig({ plugins: [], pushBaseUrl: 123 as any } as any)
|
|
106
106
|
).toThrow(
|
|
107
|
-
`Invalid Embeddable Configuration: "pushBaseUrl": Expected string, received number}
|
|
107
|
+
`Invalid Embeddable Configuration: "pushBaseUrl": Expected string, received number}`
|
|
108
108
|
);
|
|
109
109
|
});
|
|
110
110
|
|
|
@@ -157,9 +157,9 @@ describe("defineConfig", () => {
|
|
|
157
157
|
|
|
158
158
|
it("throws error for invalid region", () => {
|
|
159
159
|
expect(() =>
|
|
160
|
-
defineConfig({ plugins: [], region: "INVALID" as any })
|
|
160
|
+
defineConfig({ plugins: [], region: "INVALID" as any })
|
|
161
161
|
).toThrow(
|
|
162
|
-
`Invalid Embeddable Configuration: "region": Invalid literal value, expected "legacy-US"}
|
|
162
|
+
`Invalid Embeddable Configuration: "region": Invalid literal value, expected "legacy-US"}`
|
|
163
163
|
);
|
|
164
164
|
});
|
|
165
165
|
});
|