{"name":"noxcturnal","version":"0.1.1","description":"Native-backed JavaScript transform runtime with visitor ergonomics","license":"MIT","repository":{"type":"git","url":"git+https://github.com/expo/noxcturnal.git"},"source":"./js/index.ts","main":"./dist/noxcturnal.js","module":"./dist/noxcturnal.mjs","types":"./dist/noxcturnal.d.ts","exports":{".":{"source":"./js/index.ts","types":"./dist/noxcturnal.d.ts","import":"./dist/noxcturnal.mjs","require":"./dist/noxcturnal.js"},"./package.json":"./package.json"},"publishConfig":{"access":"public"},"dependencies":{"@babel/code-frame":"^7.20.0","@oxc-project/types":"0.141.0"},"devDependencies":{"@babel/core":"^7.29.7","@babel/generator":"7.29.7","@babel/helpers":"7.29.7","@babel/plugin-proposal-decorators":"7.29.7","@babel/plugin-transform-async-generator-functions":"7.29.7","@babel/plugin-transform-async-to-generator":"7.29.7","@babel/plugin-transform-block-scoping":"7.29.7","@babel/plugin-transform-class-properties":"7.29.7","@babel/plugin-transform-class-static-block":"7.29.7","@babel/plugin-transform-classes":"7.29.7","@babel/plugin-transform-destructuring":"7.29.7","@babel/plugin-transform-dotall-regex":"7.29.7","@babel/plugin-transform-explicit-resource-management":"7.29.7","@babel/plugin-transform-exponentiation-operator":"7.29.7","@babel/plugin-transform-export-namespace-from":"7.29.7","@babel/plugin-transform-flow-strip-types":"7.29.7","@babel/plugin-transform-for-of":"7.29.7","@babel/plugin-transform-logical-assignment-operators":"7.29.7","@babel/plugin-transform-named-capturing-groups-regex":"7.29.7","@babel/plugin-transform-nullish-coalescing-operator":"7.29.7","@babel/plugin-transform-object-rest-spread":"7.29.7","@babel/plugin-transform-optional-catch-binding":"7.29.7","@babel/plugin-transform-optional-chaining":"7.29.7","@babel/plugin-transform-parameters":"7.29.7","@babel/plugin-transform-private-methods":"7.29.7","@babel/plugin-transform-private-property-in-object":"7.29.7","@babel/plugin-transform-react-jsx":"7.29.7","@babel/plugin-transform-react-jsx-development":"7.29.7","@babel/plugin-transform-react-pure-annotations":"7.29.7","@babel/plugin-transform-runtime":"7.29.7","@babel/plugin-transform-sticky-regex":"7.29.7","@babel/plugin-transform-typescript":"^7.29.7","@babel/plugin-transform-unicode-property-regex":"7.29.7","@babel/plugin-transform-unicode-regex":"7.29.7","@babel/plugin-transform-unicode-sets-regex":"7.29.7","@babel/runtime":"7.29.7","@changesets/cli":"^2.31.1","@changesets/get-github-info":"^0.6.0","@jridgewell/trace-mapping":"^0.3.31","@napi-rs/cli":"^3.4.5","@rollup/plugin-babel":"^7.1.0","@rollup/plugin-commonjs":"^29.0.3","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-terser":"^1.0.0","@types/babel__code-frame":"^7.0.6","@types/babel__core":"7.20.5","@types/babel__generator":"7.27.0","@types/node":"^22.15.0","@vitest/coverage-v8":"^3.2.7","babel-plugin-syntax-hermes-parser":"0.36.0","babel-plugin-transform-flow-enums":"0.0.2","babel-preset-expo":"56.0.13","dotenv":"^17.2.3","esbuild":"0.28.1","hermes-parser":"0.36.0","lint-staged":"^17.1.1","npm":"11.6.2","oxfmt":"^0.60.0","prettier":"^3.9.6","regenerate-unicode-properties":"10.2.2","regexpu-core":"6.4.0","rimraf":"^6.1.3","rollup":"^4.62.3","rollup-plugin-cjs-check":"^1.0.3","rollup-plugin-dts":"^6.4.1","typescript":"^5.8.3","vitest":"^3.2.4"},"optionalDependencies":{"@noxcturnal/noxcturnal-darwin-x64":"0.1.1","@noxcturnal/noxcturnal-linux-arm64-gnu":"0.1.1","@noxcturnal/noxcturnal-darwin-arm64":"0.1.1","@noxcturnal/noxcturnal-linux-arm64-musl":"0.1.1","@noxcturnal/noxcturnal-linux-x64-gnu":"0.1.1","@noxcturnal/noxcturnal-linux-x64-musl":"0.1.1","@noxcturnal/noxcturnal-win32-arm64-msvc":"0.1.1","@noxcturnal/noxcturnal-win32-x64-msvc":"0.1.1"},"lint-staged":{"*":"oxfmt --no-error-on-unmatched-pattern"},"napi":{"binaryName":"noxcturnal","targets":["aarch64-apple-darwin","x86_64-apple-darwin","x86_64-unknown-linux-gnu","aarch64-unknown-linux-gnu","x86_64-unknown-linux-musl","aarch64-unknown-linux-musl","x86_64-pc-windows-msvc","aarch64-pc-windows-msvc"]},"engines":{"node":">=18"},"scripts":{"build":"pnpm build:native && pnpm build:js","build:js":"rimraf dist && rollup -c scripts/rollup.config.mjs","build:native":"node scripts/native.mjs build","build:release":"node scripts/native.mjs build --release && pnpm build:js","check":"node scripts/check.mjs","check:types":"tsc --noEmit && pnpm test:types","codegen":"node scripts/sync-oxc-event-schema.mjs && node scripts/generate-event-schema.mjs && node scripts/generate-inline-helpers.mjs && node scripts/generate-regexp-unicode-properties.mjs","codegen:check":"node scripts/sync-oxc-event-schema.mjs --check && node scripts/generate-event-schema.mjs --check && node scripts/generate-inline-helpers.mjs --check && node scripts/generate-regexp-unicode-properties.mjs --check && pnpm codegen:estree:check","codegen:estree":"node scripts/generate-estree-schema.mjs","codegen:estree:check":"node scripts/generate-estree-schema.mjs --check","test":"node scripts/native.mjs check && vitest run","test:watch":"node scripts/native.mjs check && vitest","test:coverage":"node scripts/native.mjs check && vitest run --coverage","test:types":"vitest run --typecheck.only","benchmark":"node scripts/native.mjs check && vitest bench --run","format":"oxfmt . && cargo fmt","format:check":"oxfmt --check . && cargo fmt --check","lint":"cargo clippy --all-targets -- -D warnings","package:check":"node scripts/check-package.mjs","changeset":"changeset","release":"node scripts/release.mjs publish"},"_id":"noxcturnal@0.1.1","bugs":{"url":"https://github.com/expo/noxcturnal/issues"},"homepage":"https://github.com/expo/noxcturnal#readme","_integrity":"sha512-Fa9SvpVNi+2AVr9CI6mkxqIIeGQNlVRLZsXdinOx1xrvV5ZvCsyBff9QRJdwnzlVnn1AIpksFe9SW9sDfzYKLw==","_resolved":"/tmp/nix-shell.VaF1sI/23949a81a3e9d4ca835211f7b91cb96d/noxcturnal-0.1.1.tgz","_from":"file:noxcturnal-0.1.1.tgz","_nodeVersion":"22.23.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-Fa9SvpVNi+2AVr9CI6mkxqIIeGQNlVRLZsXdinOx1xrvV5ZvCsyBff9QRJdwnzlVnn1AIpksFe9SW9sDfzYKLw==","shasum":"3680d180bec559b97441732480e98adfa15c7c05","tarball":"http://registry-npm.ywwl.com/noxcturnal/download/noxcturnal-0.1.1.tgz","fileCount":7,"unpackedSize":1044279,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIA7VEvWYIh9MK5f8zcWZ5YnysaaHXqmBOhyxZVk8uxcCAiBxBqxypZQB+EhajZYnC7Po1mRdMKY9InaeqmOP5voM4w=="}],"size":221587,"noattachment":false,"key":"/noxcturnal/-/noxcturnal-0.1.1.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ebeff57f-07ed-43c2-956f-a7723f33d1ae"}},"directories":{},"maintainers":[{"name":"philpl","email":"phil@kitten.sh"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/noxcturnal_0.1.1_1787157124841_0.2952026947565376"},"_hasShrinkwrap":false,"readme":"# Noxcturnal\n\nNoxcturnal is a native-backed JavaScript transformation library. It combines a typed,\nBabel-like visitor API in TypeScript with parsing, semantic analysis, traversal, edit validation,\nrendering, and source-map generation in Rust.\n\nNoxcturnal is an independent transform runtime. It is not a Metro transformer and does not collect\ndependencies, rewrite modules, or wrap output for a particular framework.\n\n> [!NOTE]\n> Noxcturnal is under active development. Its public API may change before the first stable release.\n\n## Installation\n\n```sh\npnpm add noxcturnal\n```\n\nNoxcturnal requires Node.js 18 or later. The package selects a prebuilt native binary for supported\nmacOS, Linux, and Windows targets.\n\n## Usage\n\nPlugins declare exactly which nodes and fields they need. Noxcturnal compiles those declarations\ninto native routes, sends only the requested data to JavaScript, and commits the resulting edits as\none transaction.\n\n```ts\nimport { defineNativePipeline, defineNativePlugin, defineVisitor, transform } from 'noxcturnal';\n\nconst replaceBuildId = defineNativePlugin({\n  name: 'replace-build-id',\n  contract: { metadata: { writes: ['replacedBuildId'] } },\n  visitors: [\n    defineVisitor(\n      'Identifier',\n      {\n        fields: ['name', 'global'],\n        where: { name: { equals: '__BUILD_ID__' } },\n      },\n      path => {\n        if (path.node.global) {\n          path.replaceWith(path.context.code.stringLiteral('development'));\n          path.context.metadata.set('replacedBuildId', true);\n        }\n      },\n    ),\n  ],\n});\n\nconst pipeline = defineNativePipeline({\n  phases: [{ name: 'application', plugins: [replaceBuildId] }],\n});\n\nconst result = transform('console.log(__BUILD_ID__);', 'app.js', pipeline);\n\nif (result.status === 'complete') {\n  console.log(result.code);\n}\n```\n\nEvery plugin in a phase observes the same immutable input. Its edits become visible together at the\nphase boundary, after validation and an optional reparse. Split dependent transforms into separate\nphases when a later transform must observe an earlier transform's output.\n\n### Configuration and per-file data\n\nPipeline definitions describe reusable program configuration:\n\n- `plugin.withOptions(options)` creates a definition with different declared behavior.\n- `plugin.withParameters(values)` binds values used by native predicates.\n- `pluginData` passes current-file data to state factories, hooks, and visitors.\n\n```ts\nconst result = transform(source, filename, pipeline, {\n  pluginData: { platform: 'ios' },\n});\n```\n\nDo not close over per-file data in a reusable plugin definition. Read it from `pluginData` instead.\nIf that data affects output, include it in the consumer's transform-result cache key;\n`pipelineCacheKey` intentionally covers only Noxcturnal-owned configuration.\n\n### Native transforms\n\nA phase can run declarative native transforms without a JavaScript visitor:\n\n```ts\nconst pipeline = defineNativePipeline({\n  phases: [\n    {\n      name: 'syntax',\n      native: {\n        typescript: 'strip',\n        transforms: {\n          optionalChaining: { loose: false },\n          nullishCoalescingOperator: { loose: false },\n        },\n      },\n    },\n  ],\n});\n```\n\nThe native surface includes TypeScript and Flow erasure, JSX modes, React Compiler and React\nRefresh integration, common ES syntax lowering, constant folding, and dead-code elimination.\n\n### Transform outcomes\n\n`transform` has three outcomes:\n\n- A successful transform returns a `NativeTransformResult`.\n- An intentional compatibility boundary returns a `NativeBailoutResult` with the pristine input in\n  `source`.\n- Invalid input or configuration and internal failures throw.\n\nRun a compatibility transformer only for a returned bailout. Thrown failures should propagate.\nSyntax failures use `TransformSyntaxError`; fatal native failures use `NativeTransformError` with\nthe stable code `NOXCTURNAL_TRANSFORM_ERROR`.\n\n## Development\n\nThe reproducible development environment includes Node.js, pnpm, Rust, CMake, Ninja, Python, and\nthe C++ tools needed to build the optional Hermes-backed Flow parser.\n\n```sh\nnix develop\npnpm install\npnpm build\npnpm check\npnpm benchmark\n```\n\nUse `pnpm format` to format the TypeScript and Rust sources. User-visible changes should include a\nchangeset because the main package and its native platform packages are released as one fixed\nversion group.\n\nThe test suite is organized by ownership and purpose; see [test/README.md](test/README.md) before\nadding, moving, or deleting coverage.\n\n## License\n\nMIT\n","publish_time":1787157124987,"_cnpm_publish_time":1787157124987,"dist-tags":{"canary":"0.1.0","latest":"0.1.12"}}