@superblocksteam/ai-service-templates 2.0.6-next.99 → 2.0.7

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.
Files changed (2) hide show
  1. package/package.json +3 -2
  2. package/templates.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superblocksteam/ai-service-templates",
3
- "version": "2.0.6-next.99",
3
+ "version": "2.0.7",
4
4
  "type": "module",
5
5
  "dependencies": {},
6
6
  "exports": {
@@ -20,7 +20,8 @@
20
20
  ],
21
21
  "devDependencies": {
22
22
  "@types/node": "^22.15.17",
23
- "vitest": "^3.2.0"
23
+ "vitest": "^3.2.0",
24
+ "vite": "^6.2.3"
24
25
  },
25
26
  "publishConfig": {
26
27
  "registry": "https://registry.npmjs.org"
package/templates.js CHANGED
@@ -2,7 +2,7 @@
2
2
  export const templates = {
3
3
  "api-builder-to-yaml": {
4
4
  "bootstrap.mjs": "import { register } from \"node:module\";\nimport { pathToFileURL } from \"node:url\";\n\nregister(\"./shim-loader.mjs\", pathToFileURL(\"./\"));\n",
5
- "package.json": "{\n \"type\": \"module\",\n \"dependencies\": {\n \"acorn\": \"^8.14.0\",\n \"prettier\": \"^3.5.3\",\n \"yaml\": \"^2.7.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^22.15.18\",\n \"@typescript-eslint/parser\": \"^8.34.0\",\n \"eslint\": \"^9.26.0\",\n \"typescript\": \"^5.8.3\",\n \"vitest\": \"^3.2.0\"\n }\n}\n",
5
+ "package.json": "{\n \"type\": \"module\",\n \"dependencies\": {\n \"acorn\": \"^8.14.0\",\n \"prettier\": \"^3.5.3\",\n \"yaml\": \"^2.7.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^22.15.18\",\n \"@typescript-eslint/parser\": \"^8.34.0\",\n \"eslint\": \"^9.26.0\",\n \"typescript\": \"^5.8.3\",\n \"vitest\": \"^3.2.0\",\n \"vite\": \"^6.2.3\"\n }\n}\n",
6
6
  "shim-loader.mjs": "import path from \"path\";\nimport { pathToFileURL } from \"url\";\n\nconst overrideMap = {\n \"@superblocksteam/library\": \"./dist/superblocks-library-shim/index.js\",\n};\n\nexport async function resolve(specifier, context, nextResolve) {\n if (overrideMap[specifier]) {\n const fullPath = path.resolve(overrideMap[specifier]);\n return {\n shortCircuit: true,\n url: pathToFileURL(fullPath).href,\n };\n }\n\n return nextResolve(specifier, context);\n}\n",
7
7
  "src/do-eval-to-sdk.ts": "import fs from \"fs\";\nimport path from \"path\";\nimport { fileURLToPath } from \"url\";\n\n// finds all JavaScript files in the `dist/apis-to-transform` directory,\n// imports each module, converts its JSON representation to SDK,\n// and outputs a JSON map with filenames as keys and SDK content as values.\n\nasync function main() {\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = path.dirname(__filename);\n\n const apisDir = path.resolve(__dirname, \"./to-sdk\");\n\n const files = fs.readdirSync(apisDir);\n\n const jsFiles = files.filter(\n (file) => file.endsWith(\".js\") && file !== \"__template__.js\",\n );\n\n const results: Record<string, string> = {};\n\n for (const jsFile of jsFiles) {\n const filePath = path.join(apisDir, jsFile);\n const absolutePath = path.resolve(filePath);\n\n try {\n const fileUrl = new URL(`file://${absolutePath}`);\n const module = await import(fileUrl.href);\n\n const defaultExport = module.default;\n\n if (defaultExport && typeof defaultExport.toSDK === \"function\") {\n const sdkData = await defaultExport.toSDK();\n\n results[jsFile] = sdkData;\n } else {\n console.warn(`${jsFile}: Default export doesn't have a toSDK method`);\n }\n } catch (error) {\n console.error(`Error processing ${jsFile}:`, error);\n }\n }\n\n console.log(JSON.stringify(results, null, 2));\n}\n\nmain().catch((error) => {\n console.error(\"Error:\", error);\n process.exit(1);\n});\n",
8
8
  "src/do-eval-to-yaml.ts": "import fs from \"fs\";\nimport path from \"path\";\nimport { fileURLToPath } from \"url\";\nimport yaml from \"yaml\";\n\n// finds all JavaScript files in the `dist/apis-to-transform` directory,\n// imports each module, converts its JSON representation to YAML,\n// and outputs a JSON map with filenames as keys and YAML content as values.\n\nasync function main() {\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = path.dirname(__filename);\n\n const apisDir = path.resolve(__dirname, \"./to-yaml\");\n\n const files = fs.readdirSync(apisDir);\n\n const jsFiles = files.filter((file) => file.endsWith(\".js\"));\n\n const results: Record<string, string> = {};\n\n for (const jsFile of jsFiles) {\n const filePath = path.join(apisDir, jsFile);\n const absolutePath = path.resolve(filePath);\n\n try {\n const fileUrl = new URL(`file://${absolutePath}`);\n const module = await import(fileUrl.href);\n\n const defaultExport = module.default;\n\n if (defaultExport && typeof defaultExport.toJSON === \"function\") {\n const jsonData = await defaultExport.toJSON();\n\n const yamlContent = yaml.stringify(jsonData);\n\n results[jsFile] = yamlContent;\n } else {\n console.warn(`${jsFile}: Default export doesn't have a toJSON method`);\n }\n } catch (error) {\n console.error(`Error processing ${jsFile}:`, error);\n }\n }\n\n console.log(JSON.stringify(results, null, 2));\n}\n\nmain().catch((error) => {\n console.error(\"Error:\", error);\n process.exit(1);\n});\n",