mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
8951232a0f
A consumer who imports @copilotkit/runtime and compiles with strict +
skipLibCheck: false gets 81 errors from our published declarations, 71 of
them TS1036 "Statements are not allowed in ambient contexts". Cause: the
tsdown banner that guarantees reflect-metadata loads before type-graphql
was returned as a string, and tsdown applies a string banner to every
emitted chunk -- declarations included. So all 87 published .d.cts files
began with `require("reflect-metadata");`, which is a statement and
illegal in an ambient context.
Returning an object instead lets tsdown route the banner by chunk kind, so
JS keeps its reflect-metadata prologue and declarations get nothing. The
fileName condition is gone too: tsdown's resolveChunkAddon reassigns its
own closure variable on the first call, so a function banner is evaluated
once and reused, meaning that condition was really deciding the banner for
the entire build from whichever chunk was emitted first. Keying on format
alone is order-independent.
This was invisible to us because every scaffolder sets skipLibCheck: true,
and because .d.mts got the legal `import "reflect-metadata";` form -- ESM
consumers never saw a single TS1036.
Adds a check-dts target that parses the built declarations and fails on any
top-level statement, wired into the existing package-quality job so the
class cannot come back silently.
Refs OSS-899
106 lines
2.5 KiB
JSON
106 lines
2.5 KiB
JSON
{
|
|
"$schema": "https://nx.dev/reference/nx-json",
|
|
"namedInputs": {
|
|
"default": [
|
|
"{projectRoot}/**/*",
|
|
"!{projectRoot}/node_modules/**/*",
|
|
"!{projectRoot}/**/*.md",
|
|
"!{projectRoot}/**/*.yml",
|
|
"!{projectRoot}/**/*.yaml"
|
|
],
|
|
"production": [
|
|
"default",
|
|
"!{projectRoot}/**/*.test.*",
|
|
"!{projectRoot}/**/*.spec.*",
|
|
"!{projectRoot}/**/__tests__/**"
|
|
],
|
|
"test": [
|
|
"{projectRoot}/src/**/*.ts",
|
|
"{projectRoot}/src/**/*.tsx",
|
|
"{projectRoot}/**/__tests__/**",
|
|
"{projectRoot}/**/*.test.*",
|
|
"{projectRoot}/**/*.spec.*"
|
|
]
|
|
},
|
|
"targetDefaults": {
|
|
"build": {
|
|
"dependsOn": ["^build"],
|
|
"inputs": ["production", "{projectRoot}/.env*"],
|
|
"outputs": ["{projectRoot}/dist/**"],
|
|
"cache": true
|
|
},
|
|
"dev": {
|
|
"dependsOn": ["^build"],
|
|
"cache": false
|
|
},
|
|
"test": {
|
|
"dependsOn": ["^build"],
|
|
"inputs": ["test"],
|
|
"outputs": ["{projectRoot}/coverage/**"],
|
|
"cache": true
|
|
},
|
|
"test:watch": {
|
|
"cache": false
|
|
},
|
|
"test:coverage": {
|
|
"inputs": ["test"],
|
|
"outputs": ["{projectRoot}/coverage/**"],
|
|
"cache": true
|
|
},
|
|
"check-types": {
|
|
"dependsOn": ["^build", "^check-types"],
|
|
"cache": true
|
|
},
|
|
"generate-graphql-schema": {
|
|
"dependsOn": ["^build"],
|
|
"outputs": ["{projectRoot}/__snapshots__/**"],
|
|
"cache": true
|
|
},
|
|
"graphql-codegen": {
|
|
"dependsOn": ["^build"],
|
|
"cache": true
|
|
},
|
|
"link:global": {
|
|
"cache": false
|
|
},
|
|
"unlink:global": {
|
|
"cache": false
|
|
},
|
|
"build:css": {
|
|
"cache": true,
|
|
"outputs": [
|
|
"{projectRoot}/dist/styles.css",
|
|
"{projectRoot}/src/styles/generated.css"
|
|
]
|
|
},
|
|
"storybook:build": {
|
|
"dependsOn": ["^build"],
|
|
"outputs": ["{projectRoot}/storybook-static/**"],
|
|
"cache": true
|
|
},
|
|
"publint": {
|
|
"dependsOn": ["build"],
|
|
"inputs": ["{projectRoot}/package.json", "{projectRoot}/dist/**"],
|
|
"cache": true
|
|
},
|
|
"attw": {
|
|
"dependsOn": ["build"],
|
|
"inputs": ["{projectRoot}/package.json", "{projectRoot}/dist/**"],
|
|
"cache": true
|
|
},
|
|
"compat-check": {
|
|
"dependsOn": ["build"],
|
|
"inputs": ["{projectRoot}/package.json", "{projectRoot}/dist/**"],
|
|
"cache": true
|
|
},
|
|
"check-dts": {
|
|
"dependsOn": ["build"],
|
|
"inputs": ["{projectRoot}/package.json", "{projectRoot}/dist/**"],
|
|
"cache": true
|
|
}
|
|
},
|
|
"parallel": 14,
|
|
"defaultBase": "main",
|
|
"analytics": false
|
|
}
|