{"name":"@astrojs/compiler","version":"1.4.1","author":{"name":"withastro"},"license":"MIT","_id":"@astrojs/compiler@1.4.1","homepage":"https://astro.build","bugs":{"url":"https://github.com/withastro/compiler/issues"},"dist":{"shasum":"9cf6d011a1dbdc9ff81923ec02b45043c1c71924","tarball":"http://registry-npm.ywwl.com/@astrojs/compiler/download/@astrojs/compiler-1.4.1.tgz","fileCount":29,"integrity":"sha512-aXAxapNWZwGN41P+Am/ma/2kAzKOhMNaY6YuvLkUHFv+UZkmDHD6F0fE1sQA2Up0bLjgPQa1VQzoAaii5tZWaA==","signatures":[{"sig":"MEUCIGxqRXsdM8tPMxjcrHR69OsZ5loGOfnJFtVVajBn7GxGAiEA4usuYCcwaLeutxJtqq8cNKwxeL+OZHb45skbnqV3bLk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5072074,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkUnNpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq9Dw/9Ead3v0M/aPBhmMUXb0DP9LLLyiViPoU93bNjFIsrgrR2xzua\r\niAG+rQ/wUyuZ7Vy6IZHOwH20seR32engy9AQsSIJK1sbAEPKbOP8ryrSdiNS\r\ntTg3Q23cpFVqwpAwDNiubSn9CzoErBvfTuJwd97KlgcZUh6P79nnuKgjcCPn\r\nQpFQd1maZmsEB3CoSTOHiTXJnU3T43tYFmpkJlg0RpRvKfBrEj2ABFHlzDv0\r\n4P283FGwIUWCp/ivGnJeGiZfzEpH/Y4HHoVKzzxyeOGJPh0yPSk9Y7YA00gj\r\nwsLAlez+jxudKCoDvNVWQz67rFoYhATCTWwORYNyIK/4taWiKtWt2sp62kJo\r\nNRrtZzBD7Tic8i4s+5yQrxwSA6riHR3+86VOG9RW+UFgj61Vpe+fm1+ivhfs\r\nOa7XITwIlm3OLgsZ2ejwt/c6yxq8WBcUZ34f2rzRcg10f+09dOl0bdO3PWq3\r\nO9vZeoWUf1OgEWLILX26310E+iOUIT8Jn1DNLIAupT8nPHC3VV/DbGyYX1zZ\r\nTyrOO8Qpj3/qFpdn/PfqPupdAsQ29Foo1ijekI4PMcfwn8kmsNprk/3aJ87y\r\npsvjBJhhDhM0r9m3mS3N5pDXisFPDRNFTxA548tdpGK7mEKWZJFiqkNo01PF\r\ncPqt3IlX60v8NMvzOyuGQCJcPa50qb1KrbA=\r\n=ladz\r\n-----END PGP SIGNATURE-----\r\n","size":1393517,"noattachment":false,"key":"/@astrojs/compiler/-/@astrojs/compiler-1.4.1.tgz"},"main":"./node/index.js","type":"module","_from":"file:astrojs-compiler-1.4.1.tgz","types":"./node","exports":{".":{"import":"./node/index.js","browser":"./browser/index.js","default":"./browser/index.js"},"./sync":{"import":"./node/sync.cjs","default":"./node/sync.cjs"},"./types":"./types.d.ts","./utils":{"import":"./node/utils.js","browser":"./browser/utils.js","default":"./browser/utils.js"},"./astro.wasm":"./astro.wasm"},"scripts":{"build":"tsc -p . && esbuild node/sync.cts --bundle --format=cjs --platform=node --outfile=node/sync.cjs"},"_npmUser":{"name":"fredkschott","email":"fkschott@gmail.com"},"_resolved":"","_integrity":"","repository":{"url":"git+https://github.com/withastro/compiler.git","type":"git"},"_npmVersion":"6.14.18","description":"Astro’s [Go](https://golang.org/) + WASM compiler.","directories":{},"_nodeVersion":"14.21.3","_hasShrinkwrap":false,"devDependencies":{"acorn":"^8.8.1","esbuild":"^0.17.17","typescript":"~4.9.0","@types/node":"^18.15.11","@types/sass":"^1.43.1","@jridgewell/trace-mapping":"^0.3.16"},"_npmOperationalInternal":{"tmp":"tmp/compiler_1.4.1_1683125097167_0.1349510939375531","host":"s3://npm-registry-packages"},"readme":"# Astro Compiler\n\nAstro’s [Go](https://golang.org/) + WASM compiler.\n\n## Install\n\n```\nnpm install @astrojs/compiler\n```\n\n## Usage\n\n#### Transform `.astro` to valid TypeScript\n\nThe Astro compiler can convert `.astro` syntax to a TypeScript Module whose default export generates HTML.\n\n**Some notes**...\n\n- TypeScript is valid `.astro` syntax! The output code may need an additional post-processing step to generate valid JavaScript.\n- `.astro` files rely on a server implementation exposed as `astro/runtime/server/index.js` in the Node ecosystem. Other runtimes currently need to bring their own rendering implementation and reference it via `internalURL`. This is a pain point we're looking into fixing.\n\n```js\nimport { transform } from '@astrojs/compiler';\n\nconst result = await transform(source, {\n  filename: '/Users/astro/Code/project/src/pages/index.astro',\n  sourcemap: 'both',\n  internalURL: 'astro/runtime/server/index.js',\n});\n```\n\n#### Parse `.astro` and return an AST\n\nThe Astro compiler can emit an AST using the `parse` method.\n\n**Some notes**...\n\n- Position data is currently incomplete and in some cases incorrect. We're working on it!\n- A `TextNode` can represent both HTML `text` and JavaScript/TypeScript source code.\n- The `@astrojs/compiler/utils` entrypoint exposes a `walk` function that can be used to traverse the AST. It also exposes the `is` helper which can be used as guards to derive the proper types for each `node`.\n\n```js\nimport { parse } from '@astrojs/compiler';\nimport { walk, is } from '@astrojs/compiler/utils';\n\nconst result = await parse(source, {\n  position: false, // defaults to `true`\n});\n\nwalk(result.ast, (node) => {\n  // `tag` nodes are `element` | `custom-element` | `component`\n  if (is.tag(node)) {\n    console.log(node.name);\n  }\n});\n```\n\n## Develop\n\n### VSCode / CodeSpaces\n\nA `devcontainer` configuration is available for use with VSCode's [Remote Development extension pack](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack) and GitHub CodeSpaces.\n\n## Contributing\n\n[CONTRIBUTING.md](/CONTRIBUTING.md)\n","publish_time":1683125097428,"maintainers":[{"name":"natemoo-re","email":"nate@natemoo.re"},{"name":"fredkschott","email":"fkschott@gmail.com"},{"name":"matthewp","email":"matthew@matthewphillips.info"}],"_cnpm_publish_time":1683125097428,"dist-tags":{"beta":"3.0.0-beta.1","canary":"0.1.0-canary.36","latest":"4.0.0","metadata-preview":"0.16.0-metadata-preview","next":"0.20.0-next.2","next--compact":"0.0.0-compact-20231220212312","next--dual":"0.0.0-dual-20230531170756","next--dynamic-slot-names":"0.0.0-dynamic-slot-names-20240111152903","next--err-jsx-comments-in-expr":"0.0.0-err-jsx-comments-in-expr-20231218110825","next--escaped-slash-tsx":"0.0.0-escaped-slash-tsx-20231227120419","next--fragment-in-tr-issue":"0.0.0-fragment-in-tr-issue-20231223214149","next--github-actions":"0.0.0-github-actions-20240228180311","next--head-body-content":"0.0.0-head-body-content-20240329184853","next--head-bubbling":"0.0.0-head-bubbling-20230216202235","next--head-metadata":"0.0.0-head-metadata-20230316175054","next--join-base":"0.0.0-join-base-20221208164627","next--jsx-attr-issue":"0.0.0-jsx-attr-issue-20231224202721","next--literal":"0.0.0-literal-20240329135330","next--literal-parsing":"0.0.0-literal-parsing-20240308150251","next--map-export":"0.0.0-map-export-20230418133923","next--mk-slot-expr-fix":"0.0.0-mk-slot-expr-fix-20240130083013","next--module-id":"0.0.0-module-id-20221205161912","next--namespaced-attribute-nospace":"0.0.0-namespaced-attribute-nospace-20230220235307","next--next-result-create-astro":"0.0.0-next-result-create-astro-20250926081949","next--no-panic":"0.0.0-no-panic-20231221205336","next--propagation-metadata":"0.0.0-propagation-metadata-20230907164537","next--render-script":"0.0.0-render-script-20251003120459","next--scopedStyleStrategy":"0.0.0-scopedStyleStrategy-20230501165917","next--script-order":"0.0.0-script-order-20251002140654","next--server-islands":"0.0.0-server-islands-20240620184241","next--set-directive-fix":"0.0.0-set-directive-fix-20230222151355","next--slot-pass":"0.0.0-slot-pass-20230206210453","next--slot-stream":"0.0.0-slot-stream-20230406193056","next--sourcemap":"0.0.0-sourcemap-20230103195910","next--sync":"0.0.0-sync-20230418131144","next--table-tr-expr-issue":"0.0.0-table-tr-expr-issue-20231223194846","next--teardown":"0.0.0-teardown-20230228094908","next--test-non-admin-snapshot":"0.0.0-test-non-admin-snapshot-20240308150815","next--transition-reload":"0.0.0-transition-reload-20240211162919","next--tsx-comments-whitespace":"0.0.0-tsx-comments-whitespace-20231228223836","next--tsx-prefix":"0.0.0-tsx-prefix-20231229054418","next--view-transitions":"0.0.0-view-transitions-20230731144215","next--wasm":"0.11.0-next--wasm.0","next--win":"0.0.0-win-20221104182719","next--windows":"0.0.0-windows-20221104181455","no-canonical":"0.19.0-pre.0","pre":"0.15.2-pre.0","render-head-pre":"0.17.0-pre.4","view-transitions":"1.7.0-pre.2"}}