{
  "name": "{{atom.doc['npm::name'] or atom.doc['name'] or atom['id']}}",
  "version": "{{atom.doc['npm::version'] or '0.1.0'}}",
  "files": [
    "dist/*",
    "fnet/input.yaml",
    "fnet/output.yaml"
  ],
  {% if atom.doc['npm::author'] %}
    "author": "{{atom.doc['npm::author'] | safe}}",
  {% endif %}

  {% if atom.doc['npm::description'] %}
    "description": "{{atom.doc['npm::description'] | safe}}",
  {% endif %}
  {% if atom.doc.features.project.format ==='cjs' %}
    {% if atom.doc.features.rollup_output.esm.enabled === true%}
      "main": "dist/default/esm/index.js",
      "type":"module",
    {% else %}
      "main": "dist/default/cjs/index.cjs",
    {% endif %}

    {% if atom.doc.features.dts_enabled ===true %}
    "types": "dist/default/types/index.d.ts",
    {% endif %}

    "exports":{
      ".":{
        "import":"./dist/default/esm/index.js",
        "require":"./dist/default/cjs/index.cjs"
      }
  },
  {% else %}
    "main": "dist/default/esm/index.js",
    {% if atom.doc.features.dts_enabled ===true %}
      "types": "dist/default/types/index.d.ts",
    {% endif %}
    "type":"module",
    "exports":{
      ".":{
        "import":"./dist/default/esm/index.js",
        "require":"./dist/default/cjs/index.cjs"
      }
  },
  {% endif %}
  "flownet": {
    "type": "node",
  },
  {% if atom.doc.repo.url %}
    "repository": {
        "type": "{{atom.doc.repo.type or 'git'}}",
        "url": "{{atom.doc.repo.url}}"
    },
  {% endif %}
  "license": "{{atom.doc.license or 'MIT'}}",
  "scripts": {
    
    {% if atom.doc.features.runtime.type === 'bun' %}
      "build": "bun ./build.js",
      "build:dev": "bun ./build.js --dev",
      "watch": "bun --watch --watch-mode=poll --watch-ignore-dirs=node_modules,dist --watch-paths=./src ./build.js --dev",
      "serve": "bunx serve ./"
    {% else %}
      "build": "rollup --config",
      "build:dev": "rollup --config --sourcemap --environment DEVELOPMENT",
      "watch": "rollup --config --watch --sourcemap --environment DEVELOPMENT --environment FLOWNET_WATCH",
      "serve": "bunx serve ./"
    {% endif %}

    {% if atom.doc.features.cli.enabled %}
      {% if atom.doc.features.project.format ==='cjs' %}
        ,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs"
        ,"cli:dev": "NODE_PRESERVE_SYMLINKS=1 bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.input.file}}"
        {% if atom.doc.features.cli.mcp.enabled === true %}
          ,"mcp": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs --cli-mode=mcp"
          ,"mcp-inspect": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs --cli-mode=mcp"
        {% endif %}
      {% else %}
        ,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.output.file}}"
        ,"cli:dev": "NODE_PRESERVE_SYMLINKS=1 bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.input.file}}"
        {% if atom.doc.features.cli.mcp.enabled === true %}
          ,"cli:mcp": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.output.file}} --cli-mode=mcp"
          ,"cli:mcp:inspect": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.output.file}} --cli-mode=mcp"
          ,"cli:mcp:dev": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.input.file}} --cli-mode=mcp"
          ,"cli:mcp:inspect:dev": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.input.file}} --cli-mode=mcp"
        {% endif %}
      {% endif %}
      ,"cli:compile": "fbin compile {{atom.doc.features.cli.output.file}} -o .bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes"
      ,"cli:compile:dev": "fbin compile {{atom.doc.features.cli.input.file}} -o .bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes"    
      ,"cli:install": "fbin install ./.bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes"
      ,"cli:install:symlink": "fbin install ./.bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes --symlink"
      ,"cli:uninstall": "fbin uninstall {{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes"
    {% endif %}

    {% if atom.doc.features.app.enabled %}
      ,"app": "bunx serve {{atom.doc.features.app.dir}}/"
    {% endif %}
  },

  "devDependencies": {
    {% for dep in packageDevDependencies %}
      "{{dep.package}}":"{{dep.version}}" {% if not loop.last%},{%endif%}
    {% endfor%}
  },

  "dependencies": {
    {% for dep in packageDependencies %}
      "{{dep.package}}":"{{dep.version}}" {% if not loop.last%},{%endif%}
    {% endfor%}
  }
  
  {% if atom.doc.features.cli.enabled and atom.doc['npm::bin'] %}
    ,"bin":{
      {% if atom.doc.features.project.format ==='cjs' %}
        "{{atom.doc['npm::bin']}}":"{{atom.doc.features.cli.dir}}/index.cjs"
      {% else %}
        "{{atom.doc['npm::bin']}}":"{{atom.doc.features.cli.output.file}}"
      {% endif %}
    }
  {% endif %}
}