@superblocksteam/sdk 2.0.51 → 2.0.52-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.
@@ -1,12 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Document</title>
7
- <script type="module" src="./main.jsx"></script>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- </body>
12
- </html>
@@ -1,22 +0,0 @@
1
- import "@blueprintjs/core/lib/css/blueprint.css";
2
-
3
- import htm from 'htm';
4
- import { h, Fragment, options } from "preact";
5
- import { useState } from "preact/hooks";
6
- import { render } from 'preact-render-to-string';
7
-
8
- const html = htm.bind(h);
9
-
10
- function Counter() {
11
- const [count, setCount] = useState(0);
12
-
13
- return html`
14
- <div>
15
- <button onClick=${() => setCount(count + 1)}>+</button>
16
- <span>${count}</span>
17
- <button onClick=${() => setCount(count - 1)}>-</button>
18
- </div>
19
- `;
20
- }
21
-
22
- document.getElementById('root').innerHTML = render(html`<${Counter} />`);
@@ -1,25 +0,0 @@
1
- {
2
- "name": "test-fixture",
3
- "version": "0.0.0",
4
- "lockfileVersion": 3,
5
- "requires": true,
6
- "packages": {
7
- "": {
8
- "name": "test-fixture",
9
- "version": "0.0.0",
10
- "dependencies": {
11
- "preact": "^10.26.5"
12
- }
13
- },
14
- "node_modules/preact": {
15
- "version": "10.26.5",
16
- "resolved": "https://registry.npmjs.org/preact/-/preact-10.26.5.tgz",
17
- "integrity": "sha512-fmpDkgfGU6JYux9teDWLhj9mKN55tyepwYbxHgQuIxbWQzgFg5vk7Mrrtfx7xRxq798ynkY4DDDxZr235Kk+4w==",
18
- "license": "MIT",
19
- "funding": {
20
- "type": "opencollective",
21
- "url": "https://opencollective.com/preact"
22
- }
23
- }
24
- }
25
- }
@@ -1,9 +0,0 @@
1
- {
2
- "name": "test-fixture",
3
- "type": "module",
4
- "version": "0.0.0",
5
- "private": true,
6
- "dependencies": {
7
- "preact": "^10.26.5"
8
- }
9
- }
@@ -1,74 +0,0 @@
1
- import path from "node:path";
2
- import * as chai from "chai";
3
- import asPromised from "chai-as-promised";
4
- import { describe, it } from "mocha";
5
- import { build } from "vite";
6
- import { superblocksCdnPlugin } from "../../src/dev-utils/vite-plugin-sb-cdn.mjs";
7
- import type { RollupOutput } from "rollup";
8
-
9
- chai.use(asPromised);
10
-
11
- const expect = chai.expect;
12
-
13
- describe("superblocksCdnPlugin", () => {
14
- it("should build", async function () {
15
- return expect(
16
- build({
17
- root: path.join(import.meta.dirname, "fixture"),
18
- build: {
19
- emptyOutDir: true,
20
- },
21
- plugins: [
22
- superblocksCdnPlugin({
23
- imports: {
24
- htm: "https://esm.sh/htm@latest",
25
- "preact-render-to-string":
26
- "https://esm.sh/preact-render-to-string@6.5.0?external=preact",
27
- },
28
- cssImports: {
29
- "@blueprintjs/core/lib/css/blueprint.css":
30
- "https://esm.sh/@blueprintjs/core@5.19.0/lib/css/blueprint.css?css",
31
- },
32
- }),
33
- ],
34
- }),
35
- ).not.to.eventually.be.rejected;
36
- });
37
-
38
- it("should include cdn-imported exports", async () => {
39
- const result = await build({
40
- root: path.join(import.meta.dirname, "fixture"),
41
- build: {
42
- emptyOutDir: true,
43
- },
44
- plugins: [
45
- superblocksCdnPlugin({
46
- imports: {
47
- htm: "https://esm.sh/htm@latest",
48
- "preact-render-to-string":
49
- "https://esm.sh/preact-render-to-string@6.5.0?external=preact",
50
- },
51
- cssImports: {
52
- "@blueprintjs/core/lib/css/blueprint.css":
53
- "https://esm.sh/@blueprintjs/core@5.19.0/lib/css/blueprint.css?css",
54
- },
55
- }),
56
- ],
57
- });
58
-
59
- expect(result).not.to.be.a("array");
60
-
61
- const mod = (result as RollupOutput).output.find(
62
- (f) => f.name === "preact",
63
- );
64
-
65
- expect(mod).to.be.not.undefined;
66
-
67
- const preact = await import(
68
- path.join(import.meta.dirname, "fixture", "dist", mod!.fileName)
69
- );
70
-
71
- // preact bundle should export Fragment, as `preact-render-to-string` imports it.
72
- expect(preact.Fragment).to.be.a("function");
73
- });
74
- });