@lekoarts/satteri-sandpack 1.0.0 → 1.1.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/README.md CHANGED
@@ -6,7 +6,7 @@ Author [Sandpack](https://sandpack.codesandbox.io/docs) files as fenced code blo
6
6
 
7
7
  ## Installation
8
8
 
9
- This package is ESM only and requires Node.js 22 or newer. It supports Sätteri `>=0.10.5`.
9
+ This package is ESM only and requires Node.js 22 or newer. It supports Sätteri `^0.10.5` and `^0.11.0`.
10
10
 
11
11
  ```shell
12
12
  npm install @lekoarts/satteri-sandpack satteri
@@ -65,7 +65,9 @@ import satteriSandpack from '@lekoarts/satteri-sandpack'
65
65
  import { mdxToJs } from 'satteri'
66
66
 
67
67
  const result = mdxToJs(source, {
68
- mdastPlugins: [satteriSandpack()],
68
+ mdastPlugins: [
69
+ satteriSandpack()
70
+ ],
69
71
  })
70
72
 
71
73
  console.log(result.code)
@@ -87,7 +89,11 @@ export default defineConfig({
87
89
  plugins: [
88
90
  react(),
89
91
  satteri({
90
- mdastPlugins: [satteriSandpack({ componentName: ['Playground'] })],
92
+ mdastPlugins: [
93
+ satteriSandpack({
94
+ componentName: ['Playground']
95
+ })
96
+ ],
91
97
  }),
92
98
  ],
93
99
  })
@@ -131,7 +137,9 @@ satteriSandpack()
131
137
  Use `componentName` for a custom component:
132
138
 
133
139
  ```js
134
- satteriSandpack({ componentName: ['Playground'] })
140
+ satteriSandpack({
141
+ componentName: ['Playground']
142
+ })
135
143
  ```
136
144
 
137
145
  Pass multiple names when the same document uses more than one wrapper:
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import "satteri";
2
- //#region src/types.d.ts
3
2
  interface SatteriSandpackOptions {
4
3
  /**
5
4
  * Specify one or more component names to transform.
@@ -8,11 +7,8 @@ interface SatteriSandpackOptions {
8
7
  */
9
8
  componentName?: Array<string>;
10
9
  }
11
- //#endregion
12
- //#region src/transform.d.ts
13
10
  export default function satteriSandpack(options?: Readonly<SatteriSandpackOptions>): {
14
11
  name: string;
15
12
  mdxJsxFlowElement(node: Readonly<import("satteri").MdxJsxFlowElement>): import("satteri").MdxJsxFlowElement | null;
16
13
  };
17
- //#endregion
18
14
  export type { SatteriSandpackOptions as Options };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineMdastPlugin } from "satteri";
2
- //#region src/utils.ts
2
+ // src/utils.ts
3
3
  const CODE_META_OPTIONS = [
4
4
  "active",
5
5
  "hidden",
@@ -14,8 +14,7 @@ const ERRORS = {
14
14
  INVALID_META: (attr) => `Invalid meta attribute "${attr}" found in a code block inside <Sandpack> component. Be sure to use one of these valid attributes: ${CODE_META_OPTIONS.join(", ")}.`,
15
15
  MISSING_NAME: "Code blocks inside <Sandpack> components must have a \"name\" attribute in their metadata."
16
16
  };
17
- //#endregion
18
- //#region src/node.ts
17
+ // src/node.ts
19
18
  function resolveCodeMeta(codeNode) {
20
19
  if (!codeNode.meta?.trim()) throw new Error(ERRORS.EMPTY_META);
21
20
  const meta = {};
@@ -58,8 +57,7 @@ function collectCodeFiles(node, files) {
58
57
  }
59
58
  if ("children" in node) for (const child of node.children) collectCodeFiles(child, files);
60
59
  }
61
- //#endregion
62
- //#region src/transform.ts
60
+ // src/transform.ts
63
61
  function satteriSandpack(options) {
64
62
  const componentName = options?.componentName ?? ["Sandpack"];
65
63
  return defineMdastPlugin({
@@ -70,5 +68,4 @@ function satteriSandpack(options) {
70
68
  }
71
69
  });
72
70
  }
73
- //#endregion
74
71
  export { satteriSandpack as default };
package/package.json CHANGED
@@ -1,75 +1,74 @@
1
1
  {
2
- "name": "@lekoarts/satteri-sandpack",
3
- "type": "module",
4
- "version": "1.0.0",
5
- "packageManager": "pnpm@11.5.0",
6
- "description": "Author Sandpack examples in MDX with Sätteri",
7
- "author": "LekoArts",
8
- "license": "MIT",
9
- "homepage": "https://github.com/LekoArts/satteri-sandpack#readme",
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/LekoArts/satteri-sandpack.git"
13
- },
14
- "bugs": {
15
- "url": "https://github.com/LekoArts/satteri-sandpack/issues"
16
- },
17
- "keywords": [
18
- "satteri",
19
- "sandpack",
20
- "MDX"
21
- ],
22
- "publishConfig": {
23
- "access": "public"
24
- },
25
- "sideEffects": false,
26
- "exports": {
27
- ".": {
28
- "types": "./dist/index.d.ts",
29
- "import": "./dist/index.js",
30
- "default": "./dist/index.js"
31
- },
32
- "./package.json": "./package.json"
33
- },
34
- "main": "./dist/index.js",
35
- "module": "./dist/index.js",
36
- "types": "./dist/index.d.ts",
37
- "files": [
38
- "dist"
39
- ],
40
- "engines": {
41
- "node": ">=22"
42
- },
43
- "scripts": {
44
- "lint": "eslint",
45
- "lint:fix": "eslint --fix",
46
- "build": "tsdown",
47
- "dev": "tsdown --watch",
48
- "test": "vitest run",
49
- "test:watch": "vitest watch",
50
- "typecheck": "tsc --noEmit",
51
- "changeset": "changeset",
52
- "version": "changeset version",
53
- "version:ci": "changeset version && pnpm install --lockfile-only",
54
- "release": "pnpm build && changeset publish",
55
- "check": "publint && attw --pack . --profile esm-only"
56
- },
57
- "peerDependencies": {
58
- "satteri": "^0.10.5"
59
- },
60
- "devDependencies": {
61
- "@antfu/eslint-config": "^9.0.0",
62
- "@arethetypeswrong/cli": "^0.18.5",
63
- "@changesets/changelog-github": "^1.0.1",
64
- "@changesets/cli": "^3.0.2",
65
- "@types/node": "^24.13.3",
66
- "eslint": "^10.10.0",
67
- "eslint-plugin-format": "^2.0.1",
68
- "playwright": "^1.63.0",
69
- "publint": "^0.3.24",
70
- "satteri": "^0.10.5",
71
- "tsdown": "^0.23.0",
72
- "typescript": "^6.0.3",
73
- "vitest": "^5.0.0"
74
- }
75
- }
2
+ "name": "@lekoarts/satteri-sandpack",
3
+ "type": "module",
4
+ "version": "1.1.0",
5
+ "description": "Author Sandpack examples in MDX with Sätteri",
6
+ "author": "LekoArts",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/LekoArts/satteri-sandpack#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/LekoArts/satteri-sandpack.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/LekoArts/satteri-sandpack/issues"
15
+ },
16
+ "keywords": [
17
+ "satteri",
18
+ "sandpack",
19
+ "MDX"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "sideEffects": false,
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.js",
29
+ "default": "./dist/index.js"
30
+ },
31
+ "./package.json": "./package.json"
32
+ },
33
+ "main": "./dist/index.js",
34
+ "module": "./dist/index.js",
35
+ "types": "./dist/index.d.ts",
36
+ "files": [
37
+ "dist"
38
+ ],
39
+ "engines": {
40
+ "node": ">=22"
41
+ },
42
+ "peerDependencies": {
43
+ "satteri": "^0.10.5 || ^0.11.0"
44
+ },
45
+ "devDependencies": {
46
+ "@antfu/eslint-config": "^10.0.0",
47
+ "@arethetypeswrong/cli": "^0.18.5",
48
+ "@changesets/changelog-github": "^1.0.1",
49
+ "@changesets/cli": "^3.0.3",
50
+ "@types/node": "^26.6.6",
51
+ "eslint": "^10.15.0",
52
+ "eslint-plugin-format": "^2.0.1",
53
+ "publint": "^0.3.25",
54
+ "satteri": "^0.11.7",
55
+ "tsdown": "^0.23.7",
56
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
57
+ "typescript-7": "npm:typescript@^7.0.2",
58
+ "vitest": "^5.1.1"
59
+ },
60
+ "scripts": {
61
+ "lint": "eslint",
62
+ "lint:fix": "eslint --fix",
63
+ "build": "tsdown",
64
+ "dev": "tsdown --watch",
65
+ "test": "vitest run",
66
+ "test:watch": "vitest watch",
67
+ "typecheck": "tsc --noEmit",
68
+ "changeset": "changeset",
69
+ "version": "changeset version",
70
+ "version:ci": "changeset version && pnpm install --lockfile-only",
71
+ "release": "pnpm build && changeset publish",
72
+ "check": "publint && attw --pack . --profile esm-only"
73
+ }
74
+ }