{"name":"@astrojs/compiler","version":"0.1.10","_id":"@astrojs/compiler@0.1.10","dist":{"shasum":"ca11918f18790151832be0049277bc56556e5bfb","tarball":"http://registry-npm.ywwl.com/@astrojs/compiler/download/@astrojs/compiler-0.1.10.tgz","fileCount":17,"integrity":"sha512-TKg02JN0L5Zzj9k8K443SCeDVChz5vBzcIAqt93dVZ3uuBrQS6sAOPTo/F77YX/0gKNoqUjXlnrgJ8V8yLd/2A==","signatures":[{"sig":"MEUCIQCzi8ns0dFfkCeZrLuJMDSdLIF4iTEjm2RAQfT5r3lJ2QIgXeowznsQhgXG3N0+ZLMV5BS5sTHvfH0xYQzwNYDU8o4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":613368,"size":241061,"noattachment":false,"key":"/@astrojs/compiler/-/@astrojs/compiler-0.1.10.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":"fredkschott","email":"fkschott@gmail.com"},"_npmVersion":"6.14.15","description":"Experimental WASM compiler for Astro.","directories":{},"_nodeVersion":"14.18.0","dependencies":{"typescript":"^4.3.5"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^16.4.12"},"_npmOperationalInternal":{"tmp":"tmp/compiler_0.1.10_1634129205481_0.9899960039526143","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":1634129205710,"maintainers":[{"name":"natemoo-re","email":"nate@natemoo.re"},{"name":"fredkschott","email":"fkschott@gmail.com"},{"name":"matthewp","email":"matthew@matthewphillips.info"}],"_cnpm_publish_time":1634129205710,"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"}}