@notionhq/custom-blocks-dev-shell 0.1.7 → 0.1.8

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/dist/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Workers local shell</title>
7
- <script type="module" crossorigin src="/assets/index-CR_6I3uV.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-D-HHV2_c.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-x1e1jng3.css">
9
9
  </head>
10
10
  <body>
@@ -91,10 +91,12 @@ function readSource(file) {
91
91
  throw new Error(`${file}: ${path ? `${path}: ` : ""}${issue.message}`);
92
92
  }
93
93
  const { type, icon, schema, rows } = result.output;
94
- const key = result.output.key ?? basename(file, ".json");
94
+ const filename = basename(file, ".json");
95
+ const key = result.output.key ?? filename;
95
96
  return {
96
97
  type,
97
98
  key,
99
+ filename,
98
100
  name: result.output.name ?? key,
99
101
  ...(icon !== undefined ? { icon } : {}),
100
102
  schema: Object.fromEntries(Object.entries(schema).map(([propertyKey, property]) => [
@@ -27,7 +27,7 @@ const TYPE_ALIASES = {
27
27
  * be unambiguous — while the display name stays as declared, so the sidebar
28
28
  * shows the clean name.
29
29
  */
30
- const GENERATED_PREFIX = "worker_";
30
+ const WORKER_PREFIX = "worker_";
31
31
  export function materializeWorkerSchemaDataSources(manifest, dataDir) {
32
32
  mkdirSync(dataDir, { recursive: true });
33
33
  // One descriptor per data source key: databases first (source of truth for
@@ -51,7 +51,7 @@ export function materializeWorkerSchemaDataSources(manifest, dataDir) {
51
51
  if (existing.blockKey !== undefined &&
52
52
  !samePropertySchemas(existing.properties, properties)) {
53
53
  console.warn(`Blocks "${existing.blockKey}" and "${block.key}" both declare data source ` +
54
- `"${key}" with different schemas; ${GENERATED_PREFIX}${key}.json uses the ` +
54
+ `"${key}" with different schemas; ${WORKER_PREFIX}${key}.json uses the ` +
55
55
  `schema from "${existing.blockKey}". Author a src/data file for "${block.key}" by hand.`);
56
56
  }
57
57
  continue;
@@ -67,7 +67,7 @@ export function materializeWorkerSchemaDataSources(manifest, dataDir) {
67
67
  // The key is the worker's contract and lands verbatim in the file's
68
68
  // `key`; the filename is ours, so path-hostile characters (`/`, `..`)
69
69
  // are encoded rather than allowed to leave `dataDir` or crash the write.
70
- const file = resolve(dataDir, `${GENERATED_PREFIX}${fileSafe(key)}.json`);
70
+ const file = resolve(dataDir, `${WORKER_PREFIX}${fileSafe(key)}.json`);
71
71
  if (existsSync(file)) {
72
72
  continue;
73
73
  }
@@ -96,7 +96,7 @@ function buildSource(key, descriptor) {
96
96
  }
97
97
  return {
98
98
  type: "worker",
99
- key: `${GENERATED_PREFIX}${key}`,
99
+ key: `${WORKER_PREFIX}${key}`,
100
100
  name,
101
101
  schema,
102
102
  rows: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/custom-blocks-dev-shell",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Local preview shell for Notion custom block workers.",
5
5
  "license": "MIT",
6
6
  "repository": {