{"name":"@astrojs/compiler","version":"0.8.4-pre.1","author":{"name":"withastro"},"license":"MIT","_id":"@astrojs/compiler@0.8.4-pre.1","homepage":"https://astro.build","bugs":{"url":"https://github.com/withastro/compiler/issues"},"dist":{"shasum":"bbf94eed54a659f604a1c0e981e126467d6f8822","tarball":"http://registry-npm.ywwl.com/@astrojs/compiler/download/@astrojs/compiler-0.8.4-pre.1.tgz","fileCount":14,"integrity":"sha512-zhdo74hGBH2HLwkxFmsnZoYThq9kTxvF53LbSe5VkuWBzpm5cuhGv7b90Ie4+9ca1dEm+9VFMJygeCl16grzzA==","signatures":[{"sig":"MEUCIG6sQ9xannSuPRx2F92CLphFBoFefZG7tuJVquL00zV+AiEA69HvLCL+VQWRxWsfiZBJmh1990Sv3YpVubVTsACRsx8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":695776,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh6XAWCRA9TVsSAnZWagAAEkcP/R8/pK0m3/u2mmPJTciv\nY4FU7RZHI7T1na+JUj8FxGS1xuYdiU+1Kvy+MZ5wKMxVee0yCHWZmm4fllbG\nsinwiTMWSLD1U+yKZiJ2RAItwbwDRsaxsmDw8JECHTnlLoyZqcYhqUrFCnJp\nx3tvH1L0ua7PRfzV2JcCTAZ4Mx0iwJaYohiKKB08fMqdRm1FmpHgqvP5zUqO\nBesa05HnkU8vdTUHRS0JnqAvJ5BlN7Ue9zOadTCVOb/Pa7PNfxA8LRr6d6pw\n9Dr/HzfWqwALjA0m+VH7SsRPHYxsJUg9zr3GDUwqUblPYRMDE5hy6WxiCOYa\n8f92PqSTg0xDUth+g759FBsiBQnEmMKrKnDMhOHX8dCza9HU2Q8FSgwVwXGF\ndd4gLPGTx+ikQGeMYpFU4Rueo7MQz+bFZpcasoxmLFCAzWFrEHXkE7GNpHDz\n62GPubU+xxY0Km6QFKE7usgBVhsTrJ0nSWA4dJixo+uaVoHQxanD1WoXXTkq\nic0jvJc/i5WIzJN1OhM2/SzNlI3N7UYWW9JhH83G1ifLiP7qqoxYQ/qruC9Z\nV3mo/0SyiSYCM2sfE33mmg0Y1Xii4dqQpHpaStP6an9eHCARmKGGfCqd3aN6\nqzhVT2C3QNKde8eZuwHJG4w72JUNLMo+CIzdN36hijYEeWrzeMbbDBmPA37W\nebvZ\r\n=ogR5\r\n-----END PGP SIGNATURE-----\r\n","size":272041,"noattachment":false,"key":"/@astrojs/compiler/-/@astrojs/compiler-0.8.4-pre.1.tgz"},"main":"./node/index.js","type":"module","types":"./shared/types.d.ts","volta":{"node":"16.6.2"},"exports":{".":{"import":"./node/index.js","browser":"./browser/index.js","default":"./browser/index.js"},"./astro.wasm":"./astro.wasm"},"scripts":{"build":"tsc -p ."},"_npmUser":{"name":"matthewp","email":"matthew@matthewphillips.info"},"repository":{"url":"git+https://github.com/withastro/compiler.git","type":"git"},"_npmVersion":"7.20.3","description":"Astro’s [Go](https://golang.org/) + WASM compiler.","directories":{},"_nodeVersion":"16.6.2","dependencies":{"typescript":"^4.3.5"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@types/node":"^16.4.12"},"_npmOperationalInternal":{"tmp":"tmp/compiler_0.8.4-pre.1_1642688534320_0.6864918526152763","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":1642688534653,"maintainers":[{"name":"natemoo-re","email":"nate@natemoo.re"},{"name":"fredkschott","email":"fkschott@gmail.com"},{"name":"matthewp","email":"matthew@matthewphillips.info"}],"_cnpm_publish_time":1642688534653,"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"}}