@pradip1995/framework-compiler 0.3.0 → 0.3.1

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.
@@ -20,6 +20,7 @@ function buildBackendPackageJson({ medusa, plugins, projectName = "backend" }) {
20
20
  devDependencies: {
21
21
  "@types/node": "^20.12.11",
22
22
  typescript: "^5.6.2",
23
+ "ts-node": "^10.9.2",
23
24
  },
24
25
  engines: {
25
26
  node: ">=20",
@@ -1,5 +1,9 @@
1
1
  const pluginDefinitions = require("./plugin-definitions.cjs")
2
2
 
3
+ function formatObjectKey(key) {
4
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key) ? key : JSON.stringify(key)
5
+ }
6
+
3
7
  function formatValue(value, indent = 4) {
4
8
  const pad = " ".repeat(indent)
5
9
  if (value === "homepageConfig") return "homepageConfig"
@@ -16,7 +20,7 @@ function formatValue(value, indent = 4) {
16
20
  if (value && typeof value === "object") {
17
21
  const entries = Object.entries(value)
18
22
  return `{\n${entries
19
- .map(([key, val]) => `${pad} ${key}: ${formatValue(val, indent + 2)}`)
23
+ .map(([key, val]) => `${pad} ${formatObjectKey(key)}: ${formatValue(val, indent + 2)}`)
20
24
  .join(",\n")}\n${pad}}`
21
25
  }
22
26
  return "undefined"
@@ -215,10 +219,10 @@ function generateMedusaConfig({ enabledPlugins, preset = "full" }) {
215
219
 
216
220
  const needsPathImport = hasPlugin(enabledPlugins, "medusa-analytics")
217
221
 
218
- return `${needsPathImport ? 'import path from "path"\n' : ""}${needsPathImport ? 'import { createRequire } from "module"\n' : ""}import { loadEnv, defineConfig, Modules, ContainerRegistrationKeys } from "@medusajs/framework/utils"
222
+ return `${needsPathImport ? 'import path from "path"\n' : ""}import { loadEnv, defineConfig, Modules, ContainerRegistrationKeys } from "@medusajs/framework/utils"
219
223
  import homepageConfig from "./config/homepage-config.json"
220
224
  import { PRODUCT_METADATA_DESCRIPTORS } from "./src/config/product-metadata-descriptors"
221
- ${needsPathImport ? "\nconst require = createRequire(import.meta.url)\n" : ""}
225
+
222
226
  loadEnv(process.env.NODE_ENV || "development", process.cwd())
223
227
 
224
228
  const storefrontUrl = process.env.STOREFRONT_URL || "http://localhost:8000"
@@ -7,15 +7,20 @@
7
7
  "emitDecoratorMetadata": true,
8
8
  "experimentalDecorators": true,
9
9
  "skipLibCheck": true,
10
+ "skipDefaultLibCheck": true,
10
11
  "declaration": false,
12
+ "sourceMap": false,
13
+ "inlineSourceMap": true,
11
14
  "outDir": "./.medusa/server",
12
15
  "rootDir": "./",
13
16
  "jsx": "react-jsx",
14
17
  "forceConsistentCasingInFileNames": true,
15
18
  "resolveJsonModule": true,
19
+ "checkJs": false,
16
20
  "strictNullChecks": true
17
21
  },
18
22
  "ts-node": {
23
+ "swc": false,
19
24
  "compiler": "typescript",
20
25
  "transpileOnly": true
21
26
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pradip1995/framework-compiler",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {