experimental-ash 0.24.0 → 0.24.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/src/chunks/authored-module-loader-DcCfCiBm.js +4 -0
- package/dist/src/chunks/client-DLHAGI2g.js +4 -0
- package/dist/src/chunks/dev-authored-source-watcher-CBID_Dwh.js +1 -0
- package/dist/src/chunks/{errors-DsO9xmQL.js → errors-HYWjHxV6.js} +1 -1
- package/dist/src/chunks/{gray-matter-BxS7ZG-J.js → gray-matter-D-9jHwOT.js} +4 -4
- package/dist/src/chunks/host-zBy9FyyX.js +70 -0
- package/dist/src/chunks/{jsdist-M7JFZoA4.js → jsdist-BkeWZ7EZ.js} +61 -61
- package/dist/src/chunks/package-HUaeub_D.js +1 -0
- package/dist/src/chunks/paths-CebY5GCi.js +89 -0
- package/dist/src/chunks/{picocolors-Bq-tZK9u.js → picocolors-aAkqW4On.js} +1 -1
- package/dist/src/chunks/token-D98SQdvs.js +1 -0
- package/dist/src/chunks/{url-BVRhVE2O.js → url-JdCGA634.js} +1 -1
- package/dist/src/cli/commands/info.js +1 -1
- package/dist/src/cli/dev/environment.d.ts +16 -2
- package/dist/src/cli/dev/environment.js +1 -1
- package/dist/src/cli/dev/input-requests.js +1 -1
- package/dist/src/cli/dev/repl.js +3 -3
- package/dist/src/cli/dev/url.js +1 -1
- package/dist/src/cli/run.js +1 -1
- package/dist/src/cli/ui/output.js +1 -1
- package/dist/src/client/index.d.ts +1 -0
- package/dist/src/client/index.js +1 -0
- package/dist/src/compiled/.vendor-stamp.json +7 -6
- package/dist/src/compiled/@ai-sdk/anthropic/index.js +1 -1
- package/dist/src/compiled/@ai-sdk/google/index.js +1 -1
- package/dist/src/compiled/@ai-sdk/mcp/index.js +1 -1
- package/dist/src/compiled/@ai-sdk/openai/index.js +1 -1
- package/dist/src/compiled/@ai-sdk/otel/index.js +1 -1
- package/dist/src/compiled/@chat-adapter/slack/_slack-web-api.d.ts +7 -0
- package/dist/src/compiled/@chat-adapter/slack/index.d.ts +418 -109
- package/dist/src/compiled/@chat-adapter/slack/index.js +31 -27
- package/dist/src/compiled/@chat-adapter/slack/package.json +1 -1
- package/dist/src/compiled/@chat-adapter/state-memory/index.d.ts +8 -2
- package/dist/src/compiled/@chat-adapter/state-memory/index.js +1 -1
- package/dist/src/compiled/@chat-adapter/state-memory/package.json +1 -1
- package/dist/src/compiled/@opentelemetry/api/index.js +1 -1
- package/dist/src/compiled/@vercel/sandbox/index.js +19 -17
- package/dist/src/compiled/@vercel/sandbox/package.json +1 -1
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/runtime.js +22 -22
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/_chunks/node/auth-ZhCJAHxl.js +2 -0
- package/dist/src/compiled/_chunks/node/{dist-BdWHjlRQ.js → dist-BQYUcBqu.js} +31 -31
- package/dist/src/compiled/_chunks/node/{chunk-Dd2tEFlW.js → dist-BdTs18CF.js} +1 -1
- package/dist/src/compiled/_chunks/node/retry-DkR2H1Y0.js +1 -0
- package/dist/src/compiled/_chunks/node/token-CoIbMZkq.js +1 -0
- package/dist/src/compiled/_chunks/node/{version-BMyZn3Y2.js → version-D4IYmfaS.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/coerce-BhzIW-Hm.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{compat-CIROS3w4.js → compat-DcEvieoj.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{core-DOVmxHH8.js → core-XWIi7wKc.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/{dist-C7wPwOI9.js → dist-DO14ZaQj.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{dist-CpUQh3NH.js → dist-DZZY3Zyp.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-DOMbNs-S.js +51 -0
- package/dist/src/compiled/_chunks/workflow/{schemas-DFZoEyCn.js → schemas-DmgDnhW3.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/sleep-CRjce49s.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{src-ClRYdO4-.js → src-B54rYDvB.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/symbols-D8paKc8P.js +9 -0
- package/dist/src/compiled/_chunks/workflow/{token-CsNmv7KW.js → token-D9z1dMB6.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{token-j5Cl4rrs.js → token-DV7rQw_t.js} +1 -1
- package/dist/src/compiled/chat/index.d.ts +6 -3143
- package/dist/src/compiled/chat/index.js +1 -1
- package/dist/src/compiled/chat/{jsx-runtime-DxGwoLu2.d.ts → jsx-runtime-CFq1K_Ve.d.ts} +1 -1
- package/dist/src/compiled/chat/package.json +1 -1
- package/dist/src/compiled/jose/index.js +2 -2
- package/dist/src/compiled/jsonc-parser/LICENSE.md +21 -0
- package/dist/src/compiled/jsonc-parser/index.d.ts +13 -0
- package/dist/src/compiled/jsonc-parser/index.js +15 -0
- package/dist/src/compiled/jsonc-parser/package.json +7 -0
- package/dist/src/compiled/just-bash/index.js +773 -773
- package/dist/src/compiled/just-bash/package.json +1 -1
- package/dist/src/compiled/turndown/index.js +1 -1
- package/dist/src/compiled/zod/index.js +1 -1
- package/dist/src/compiled/zod-validation-error/index.js +1 -1
- package/dist/src/compiler/manifest.d.ts +36 -3
- package/dist/src/compiler/manifest.js +5 -1
- package/dist/src/compiler/module-map.js +8 -0
- package/dist/src/compiler/normalize-manifest.js +1 -0
- package/dist/src/compiler/normalize-subagent.d.ts +3 -2
- package/dist/src/compiler/normalize-subagent.js +112 -3
- package/dist/src/compiler/remote-agent-node.d.ts +20 -0
- package/dist/src/compiler/remote-agent-node.js +19 -0
- package/dist/src/discover/discover-subagent.js +35 -2
- package/dist/src/discover/grammar.d.ts +1 -0
- package/dist/src/discover/grammar.js +5 -0
- package/dist/src/evals/cli/eval.js +1 -1
- package/dist/src/evals/loaders/yaml.js +1 -1
- package/dist/src/evals/runner/discover.js +1 -1
- package/dist/src/evals/runner/execute-suite.js +1 -1
- package/dist/src/evals/runner/reporters/console.js +1 -1
- package/dist/src/evals/scorers/autoevals-client.js +1 -1
- package/dist/src/evals/scorers/autoevals.js +1 -1
- package/dist/src/evals/scorers/json.js +1 -1
- package/dist/src/evals/scorers/run.js +1 -1
- package/dist/src/evals/scorers/sql.js +1 -1
- package/dist/src/evals/scorers/text.js +1 -1
- package/dist/src/execution/connection-auth-steps.js +2 -0
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-asset-import-plugin.d.ts +5 -0
- package/dist/src/internal/authored-asset-import-plugin.js +141 -0
- package/dist/src/internal/authored-module-bundle.d.ts +4 -0
- package/dist/src/internal/authored-module-bundle.js +19 -0
- package/dist/src/internal/authored-module-loader.d.ts +6 -0
- package/dist/src/internal/authored-module-loader.js +114 -125
- package/dist/src/internal/authored-package-tsconfig-paths.d.ts +9 -0
- package/dist/src/internal/authored-package-tsconfig-paths.js +209 -0
- package/dist/src/internal/nitro/host/channel-routes.d.ts +9 -2
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.d.ts +12 -1
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +19 -3
- package/dist/src/internal/nitro/host/schedule-task-routes.d.ts +7 -3
- package/dist/src/internal/nitro/host/start-development-server.js +2 -0
- package/dist/src/internal/workflow-bundle/builder-support.js +1 -33
- package/dist/src/public/agents/auth.d.ts +30 -0
- package/dist/src/public/agents/auth.js +37 -0
- package/dist/src/public/definitions/remote-agent.d.ts +25 -0
- package/dist/src/public/definitions/remote-agent.js +11 -0
- package/dist/src/public/index.d.ts +1 -0
- package/dist/src/public/index.js +1 -0
- package/dist/src/public/next/index.d.ts +4 -4
- package/dist/src/public/next/index.js +16 -25
- package/dist/src/runtime/connections/mcp-client.js +3 -2
- package/dist/src/runtime/connections/types.d.ts +24 -0
- package/dist/src/runtime/resolve-agent-graph.js +57 -0
- package/dist/src/runtime/sessions/turn.d.ts +17 -5
- package/dist/src/runtime/subagents/registry.d.ts +6 -6
- package/dist/src/runtime/subagents/registry.js +1 -1
- package/dist/src/runtime/types.d.ts +20 -0
- package/package.json +22 -17
- package/dist/src/chunks/authored-module-loader-XcFLnl49.js +0 -2
- package/dist/src/chunks/client-nshDsWNF.js +0 -4
- package/dist/src/chunks/dev-authored-source-watcher-B4PaZGUr.js +0 -7
- package/dist/src/chunks/host-DsW72Q-w.js +0 -65
- package/dist/src/chunks/package-DmsQgn4v.js +0 -1
- package/dist/src/chunks/paths-OknjaYR8.js +0 -89
- package/dist/src/chunks/prewarm-B4YblQ5m.js +0 -6
- package/dist/src/chunks/token-DtoyQZy2.js +0 -1
- package/dist/src/chunks/token-util-CHjOk3A7.js +0 -1
- package/dist/src/compiled/_chunks/node/auth-vbe4XEEK.js +0 -2
- package/dist/src/compiled/_chunks/node/dist-DMSq2ehP.js +0 -1
- package/dist/src/compiled/_chunks/node/retry-BOcy5BbJ.js +0 -1
- package/dist/src/compiled/_chunks/node/token-D-BTJHoU.js +0 -1
- package/dist/src/compiled/_chunks/workflow/coerce-Dh0wa7P9.js +0 -1
- package/dist/src/compiled/_chunks/workflow/context-errors-Bbvvp-li.js +0 -6
- package/dist/src/compiled/_chunks/workflow/dist-C_oiE-l7.js +0 -40
- package/dist/src/compiled/_chunks/workflow/resume-hook-C3VWUPii.js +0 -12
- package/dist/src/compiled/_chunks/workflow/sleep-QTkC1VFe.js +0 -1
- package/dist/src/compiled/_chunks/workflow/symbols-QezhMuLg.js +0 -4
- package/dist/src/compiled/chat/_workflow-serde.d.ts +0 -5
- /package/dist/src/chunks/{chunk-8L7ocgPr.js → chunk-DSjMdhoD.js} +0 -0
- /package/dist/src/chunks/{guards-CjJ3lmju.js → guards-26p6sOw3.js} +0 -0
- /package/dist/src/chunks/{input-requests-BsBi7_5K.js → input-requests-DJiy6dG9.js} +0 -0
- /package/dist/src/chunks/{runtime-model-BWu6M_hq.js → runtime-model-Dh0Nz64z.js} +0 -0
- /package/dist/src/chunks/{types-MZUhN0Zy.js → types-DDA2QUED.js} +0 -0
- /package/dist/src/compiled/_chunks/workflow/{chunk-DHhdAPOb.js → chunk-DSjMdhoD.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"../../../chunks/chunk-
|
|
1
|
+
import{i as e}from"../../../chunks/chunk-DSjMdhoD.js";import{t}from"../../../chunks/picocolors-aAkqW4On.js";var n=e(t(),1),r=class{#e;#t;#n;constructor(e){this.#e=e?.log??console.log,this.#t=n.default.createColors(e?.color??!!process.stdout.isTTY)}onSuiteStart(e,t){this.#n=e.thresholds,this.#e(``),this.#e(`${this.#t.bold(this.#t.cyan(`EVAL`))} ${this.#t.bold(e.id)}`),this.#e(`${this.#t.dim(`target`)} ${t.kind===`local`?this.#t.green(t.url):this.#t.blue(t.url)}`),this.#e(``)}onCaseComplete(e){let{case:t,scores:n,error:r}=e,i=n.every(e=>{if(e.score===null)return!0;let t=this.#n?.[e.name]??1;return e.score>=t}),a=r?this.#t.red(`✗`):i?this.#t.green(`✓`):this.#t.yellow(`○`),o=n.map(e=>this.#r(e.name,e.score)).join(` `),s=[a,this.#t.dim(t.id),o].filter(Boolean).join(` `);this.#e(s),r&&this.#e(` ${this.#t.red(r)}`)}onSuiteComplete(e){this.#e(``);let{passed:t,errored:n,cases:r}=e,o=r.length,s=[];t>0&&s.push(this.#t.green(`${t} passed`)),n>0&&s.push(this.#t.red(`${n} errored`));let c=o-t-n;c>0&&s.push(this.#t.yellow(`${c} scored`)),this.#e(`${this.#t.bold(`Results:`)} ${s.join(`, `)} ${this.#t.dim(`(${o} total)`)}`);let l=this.#i(r);if(l.length>0){this.#e(``);for(let{name:e,avg:t,count:n}of l){let r=this.#r(e,t);this.#e(` ${r} ${this.#t.dim(`(${n} cases)`)}`)}}let u=i(e.startedAt,e.completedAt);this.#e(``),this.#e(this.#t.dim(`Completed in ${a(u)}`)),this.#e(``)}#r(e,t){if(t===null)return this.#t.dim(`${e}: n/a`);let n=`${e}: ${Math.round(t*100)}%`;return t===1?this.#t.green(n):t===0?this.#t.red(n):this.#t.yellow(n)}#i(e){let t=new Map;for(let n of e)for(let e of n.scores){if(e.score===null)continue;let n=t.get(e.name);n?(n.sum+=e.score,n.count+=1):t.set(e.name,{sum:e.score,count:1})}return[...t.entries()].map(([e,{sum:t,count:n}])=>({name:e,avg:t/n,count:n}))}};function i(e,t){return new Date(t).getTime()-new Date(e).getTime()}function a(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${(e%6e4/1e3).toFixed(0)}s`}export{r as ConsoleReporter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../chunks/jsdist-
|
|
1
|
+
import"../../chunks/jsdist-BkeWZ7EZ.js";import{generateText as e,jsonSchema as t}from"ai";function n(e){return{chat:{completions:{create:t=>r(t,e)}}}}async function r(t,n){let r=o(t.tools),a=await e({model:n.languageModel,messages:i(t.messages??[]),tools:Object.keys(r).length>0?r:void 0,toolChoice:s(t.tool_choice),providerOptions:n.providerOptions}),c=a.toolCalls.map(e=>({id:e.toolCallId,type:`function`,function:{name:e.toolName,arguments:JSON.stringify(e.input??{})}}));return{choices:[{index:0,finish_reason:c.length>0?`tool_calls`:`stop`,message:{role:`assistant`,content:a.text||null,tool_calls:c.length>0?c:void 0}}]}}function i(e){return e.map(e=>{let t=a(e.content);switch(e.role){case`assistant`:return{role:`assistant`,content:t};case`developer`:case`system`:return{role:`system`,content:t};default:return{role:`user`,content:t}}})}function a(e){return e==null?``:typeof e==`string`?e:e.map(e=>e.text??``).filter(Boolean).join(`
|
|
2
2
|
`)}function o(e){let n={};for(let r of e??[])r.type!==`function`||r.function?.name===void 0||(n[r.function.name]={description:r.function.description,inputSchema:t(r.function.parameters??{})});return n}function s(e){if(e!==void 0)return typeof e==`string`?e:{type:`tool`,toolName:e.function.name}}export{n as createAutoevalsClient};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"../../chunks/chunk-
|
|
1
|
+
import{n as e}from"../../chunks/chunk-DSjMdhoD.js";import{t}from"../../chunks/runtime-model-Dh0Nz64z.js";import{a as n,i as r,n as i,t as a}from"../../chunks/jsdist-BkeWZ7EZ.js";import{createAutoevalsClient as o}from"./autoevals-client.js";import"ai";var s=e({closedQA:()=>d,factuality:()=>c,sql:()=>u,summary:()=>l});function c(e={}){return f(i,e)}function l(e={}){return f(n,e)}function u(e={}){return f(r,e)}function d(e){return async n=>{let r=e.model??n.model;return m(await a({input:n.input,output:n.output,criteria:e.criteria,model:t(r),client:o({languageModel:r,providerOptions:p(n,e.modelOptions)})}))}}function f(e,n){return async r=>{let i=n.model??r.model;return m(await e({input:r.input,output:r.output,expected:r.expected,model:t(i),client:o({languageModel:i,providerOptions:p(r,n.modelOptions)})}))}}function p(e,t){let n=e.modelOptions?.providerOptions,r=t?.providerOptions;if(!(n===void 0&&r===void 0))return{...n,...r}}function m(e){return{name:e.name,score:e.score,metadata:e.metadata}}export{d as closedQA,c as factuality,u as sql,l as summary,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"../../chunks/chunk-
|
|
1
|
+
import{n as e}from"../../chunks/chunk-DSjMdhoD.js";var t=e({deepEqual:()=>n});function n(){return({case:e,result:t})=>e.expected===void 0?null:{name:`json.deepEqual`,score:+(r(t.output)===r(e.expected))}}function r(e){return JSON.stringify(e,(e,t)=>{if(typeof t==`object`&&t&&!Array.isArray(t)){let e={};for(let n of Object.keys(t).sort())e[n]=t[n];return e}return t})}export{n as deepEqual,t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"../../chunks/chunk-
|
|
1
|
+
import{n as e}from"../../chunks/chunk-DSjMdhoD.js";var t=e({didNotFail:()=>n,maxToolCalls:()=>a,usedNoTools:()=>i,usedTool:()=>r});function n(){return({result:e})=>({name:`run.didNotFail`,score:e.status===`failed`?0:1})}function r(e){return({result:t})=>{let n=+!!t.derived.toolCalls.includes(e);return{name:`run.usedTool(${e})`,score:n,metadata:{expectedTool:e,actualToolCalls:t.derived.toolCalls}}}}function i(){return({result:e})=>({name:`run.usedNoTools`,score:+(e.derived.toolCallCount===0),metadata:{toolCallCount:e.derived.toolCallCount}})}function a(e){return({result:t})=>{let n=+(t.derived.toolCallCount<=e);return{name:`run.maxToolCalls(${e})`,score:n,metadata:{maxAllowed:e,actualToolCallCount:t.derived.toolCallCount}}}}export{n as didNotFail,a as maxToolCalls,t,i as usedNoTools,r as usedTool};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"../../chunks/chunk-
|
|
1
|
+
import{n as e}from"../../chunks/chunk-DSjMdhoD.js";var t=e({exactNormalized:()=>n});function n(){return({output:e,expected:t})=>{if(t===void 0)return null;let n=r(e),i=r(t);return{name:`sql.exactNormalized`,score:+(n===i),metadata:{normalizedOutput:n,normalizedExpected:i}}}}function r(e){return e.toLowerCase().replace(/\s+/g,` `).trim().replace(/;+$/,``)}export{n as exactNormalized,t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"../../chunks/chunk-
|
|
1
|
+
import{n as e}from"../../chunks/chunk-DSjMdhoD.js";import{r as t}from"../../chunks/jsdist-BkeWZ7EZ.js";var n=e({exact:()=>r,includes:()=>i,levenshtein:()=>a});function r(){return({output:e,expected:t})=>t===void 0?null:{name:`text.exact`,score:+(e===t)}}function i(){return({output:e,expected:t})=>t===void 0?null:{name:`text.includes`,score:+!!e.includes(t)}}function a(){return async({output:e,expected:n})=>n===void 0?null:{name:`text.levenshtein`,score:(await t({output:e,expected:n})).score}}export{r as exact,i as includes,a as levenshtein,n as t};
|
|
@@ -51,6 +51,7 @@ export async function startAuthorizationForConnectionStep(input) {
|
|
|
51
51
|
principal = resolveConnectionPrincipal(input.connectionName, connection.authorization, ctx);
|
|
52
52
|
const startResult = await connection.authorization.startAuthorization({
|
|
53
53
|
principal,
|
|
54
|
+
connection: { url: connection.url },
|
|
54
55
|
callbackUrl: input.webhookUrl,
|
|
55
56
|
});
|
|
56
57
|
challenge = withDefaultAuthorizationInstructions(startResult.challenge, input.connectionName);
|
|
@@ -134,6 +135,7 @@ export async function completeAuthorizationForConnectionStep(input) {
|
|
|
134
135
|
try {
|
|
135
136
|
const token = await connection.authorization.completeAuthorization({
|
|
136
137
|
principal: input.principal,
|
|
138
|
+
connection: { url: connection.url },
|
|
137
139
|
request: input.request,
|
|
138
140
|
state: input.state,
|
|
139
141
|
callbackUrl: input.webhookUrl,
|
|
@@ -6,7 +6,7 @@ import { ASH_PACKAGE_NAME } from "#package-name.js";
|
|
|
6
6
|
let cachedPackageInfo;
|
|
7
7
|
// The package build stamps the published version into `dist` so bundled
|
|
8
8
|
// deployments can still report package metadata without resolving package.json.
|
|
9
|
-
const BUNDLED_FALLBACK_PACKAGE_VERSION = "0.24.
|
|
9
|
+
const BUNDLED_FALLBACK_PACKAGE_VERSION = "0.24.2";
|
|
10
10
|
const BUNDLED_FALLBACK_PACKAGE_VERSION_PLACEHOLDER = "__ASH_PACKAGE_VERSION_PLACEHOLDER__";
|
|
11
11
|
const WORKFLOW_MODULE_ALIASES = {
|
|
12
12
|
"workflow/api": "src/compiled/@workflow/core/runtime.js",
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, extname, isAbsolute, resolve } from "node:path";
|
|
3
|
+
const AUTHORED_ASSET_CODE_EXTENSIONS = [
|
|
4
|
+
".ts",
|
|
5
|
+
".tsx",
|
|
6
|
+
".mts",
|
|
7
|
+
".cts",
|
|
8
|
+
".js",
|
|
9
|
+
".jsx",
|
|
10
|
+
".mjs",
|
|
11
|
+
".cjs",
|
|
12
|
+
".json",
|
|
13
|
+
];
|
|
14
|
+
/**
|
|
15
|
+
* Creates the Rollup-compatible plugin that gives authored modules a small
|
|
16
|
+
* asset-module surface for non-code relative imports.
|
|
17
|
+
*/
|
|
18
|
+
export function createAuthoredAssetImportPlugin() {
|
|
19
|
+
return {
|
|
20
|
+
name: "ash-authored-asset-import",
|
|
21
|
+
resolveId(source, importer) {
|
|
22
|
+
if (!isPotentialAuthoredAssetImport(source) || importer === undefined) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const { path, suffix } = splitImportSuffix(source);
|
|
26
|
+
const resolvedPath = isAbsolute(path) ? path : resolve(dirname(importer), path);
|
|
27
|
+
return `${resolvedPath}${suffix}`;
|
|
28
|
+
},
|
|
29
|
+
async load(id) {
|
|
30
|
+
const { path, suffix } = splitImportSuffix(id);
|
|
31
|
+
if (!isPotentialAuthoredAssetImport(path)) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
if (suffix === "?raw") {
|
|
35
|
+
const source = await readAssetText(path);
|
|
36
|
+
if (source === undefined) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
code: `export default ${JSON.stringify(source)};`,
|
|
41
|
+
moduleType: "js",
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const dataUrl = await readAssetDataUrl(path);
|
|
45
|
+
if (dataUrl === undefined) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
code: `export default ${JSON.stringify(dataUrl)};`,
|
|
50
|
+
moduleType: "js",
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async function readAssetText(path) {
|
|
56
|
+
try {
|
|
57
|
+
return await readFile(path, "utf8");
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
if (isPathNotFoundError(error)) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function isPotentialAuthoredAssetImport(source) {
|
|
67
|
+
if (source.startsWith("\0") ||
|
|
68
|
+
source.startsWith("node:") ||
|
|
69
|
+
source.startsWith("data:") ||
|
|
70
|
+
source.startsWith("file:")) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
const { path } = splitImportSuffix(source);
|
|
74
|
+
if (!path.startsWith(".") && !path.startsWith("/") && !/^[A-Za-z]:[\\/]/.test(path)) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
const extension = extname(path);
|
|
78
|
+
return (extension.length > 0 &&
|
|
79
|
+
extension !== ".node" &&
|
|
80
|
+
!AUTHORED_ASSET_CODE_EXTENSIONS.includes(extension));
|
|
81
|
+
}
|
|
82
|
+
function splitImportSuffix(specifier) {
|
|
83
|
+
const queryIndex = specifier.indexOf("?");
|
|
84
|
+
const hashIndex = specifier.indexOf("#");
|
|
85
|
+
const suffixIndex = queryIndex === -1 ? hashIndex : hashIndex === -1 ? queryIndex : Math.min(queryIndex, hashIndex);
|
|
86
|
+
if (suffixIndex === -1) {
|
|
87
|
+
return {
|
|
88
|
+
path: specifier,
|
|
89
|
+
suffix: "",
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
path: specifier.slice(0, suffixIndex),
|
|
94
|
+
suffix: specifier.slice(suffixIndex),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
async function readAssetDataUrl(path) {
|
|
98
|
+
try {
|
|
99
|
+
const bytes = await readFile(path);
|
|
100
|
+
return `data:${getAssetMimeType(path)};base64,${bytes.toString("base64")}`;
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (isPathNotFoundError(error)) {
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function isPathNotFoundError(error) {
|
|
110
|
+
return (typeof error === "object" &&
|
|
111
|
+
error !== null &&
|
|
112
|
+
"code" in error &&
|
|
113
|
+
(error.code === "ENOENT" || error.code === "ENOTDIR"));
|
|
114
|
+
}
|
|
115
|
+
function getAssetMimeType(path) {
|
|
116
|
+
switch (extname(path).toLowerCase()) {
|
|
117
|
+
case ".css":
|
|
118
|
+
return "text/css";
|
|
119
|
+
case ".csv":
|
|
120
|
+
return "text/csv";
|
|
121
|
+
case ".gif":
|
|
122
|
+
return "image/gif";
|
|
123
|
+
case ".html":
|
|
124
|
+
return "text/html";
|
|
125
|
+
case ".jpg":
|
|
126
|
+
case ".jpeg":
|
|
127
|
+
return "image/jpeg";
|
|
128
|
+
case ".png":
|
|
129
|
+
return "image/png";
|
|
130
|
+
case ".svg":
|
|
131
|
+
return "image/svg+xml";
|
|
132
|
+
case ".txt":
|
|
133
|
+
return "text/plain";
|
|
134
|
+
case ".wasm":
|
|
135
|
+
return "application/wasm";
|
|
136
|
+
case ".webp":
|
|
137
|
+
return "image/webp";
|
|
138
|
+
default:
|
|
139
|
+
return "application/octet-stream";
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds actionable context to lower-level authored module bundling failures.
|
|
3
|
+
*/
|
|
4
|
+
export function createAuthoredModuleBundleError(modulePath, error) {
|
|
5
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6
|
+
const hints = [];
|
|
7
|
+
if (/\.node(?:\b|["'?])/i.test(message) ||
|
|
8
|
+
/native addon|native module|invalid utf-?8|Could not load .*\.node/i.test(message)) {
|
|
9
|
+
hints.push("If this comes from a native Node package, keep that package external with agent build.externalDependencies so Vercel/Nitro traces it instead of bundling it.");
|
|
10
|
+
}
|
|
11
|
+
if (/Unexpected character|No loader is configured|Could not load|Unknown file extension/i.test(message)) {
|
|
12
|
+
hints.push("If this comes from an asset import, Ash only supports assets that Rolldown can emit for a Node ESM bundle; otherwise load the file through fs/import.meta.url or externalize the package.");
|
|
13
|
+
}
|
|
14
|
+
return new Error([
|
|
15
|
+
`Failed to bundle authored module "${modulePath}".`,
|
|
16
|
+
message,
|
|
17
|
+
...hints.map((hint) => `Hint: ${hint}`),
|
|
18
|
+
].join("\n"));
|
|
19
|
+
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers a loaded channel module in the global cache so Rolldown-
|
|
3
|
+
* bundled schedule modules that import the same channel get the exact
|
|
4
|
+
* same route object instance.
|
|
5
|
+
*/
|
|
6
|
+
export declare function registerChannelModuleInCache(absolutePath: string, moduleDefault: unknown): void;
|
|
1
7
|
/**
|
|
2
8
|
* Loads one authored module namespace from disk during compile-time
|
|
3
9
|
* discovery. Concurrent loads of the same `modulePath` share a single
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
import { existsSync, mkdirSync,
|
|
2
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { dirname, join, resolve, sep } from "node:path";
|
|
4
|
+
import { createAuthoredAssetImportPlugin } from "#internal/authored-asset-import-plugin.js";
|
|
5
|
+
import { createAuthoredModuleBundleError } from "#internal/authored-module-bundle.js";
|
|
6
|
+
import { createAuthoredPackageTsConfigPathsPlugin } from "#internal/authored-package-tsconfig-paths.js";
|
|
4
7
|
import { expectObjectRecord } from "#internal/authored-module.js";
|
|
5
8
|
import { buildWithNitroRolldown, getSingleRolldownChunk, } from "#internal/bundler/nitro-rolldown.js";
|
|
6
9
|
import { createNodeEsmCompatBannerPlugin } from "#internal/node-esm-compat-banner.js";
|
|
@@ -17,22 +20,42 @@ const RESOLVE_EXTENSIONS = [
|
|
|
17
20
|
".cjs",
|
|
18
21
|
".json",
|
|
19
22
|
];
|
|
23
|
+
const CHANNEL_MODULE_CACHE_KEY = "__ashChannelModuleCache__";
|
|
24
|
+
const CACHED_CHANNEL_PREFIX = "ash-cached-channel:";
|
|
25
|
+
/**
|
|
26
|
+
* Registers a loaded channel module in the global cache so Rolldown-
|
|
27
|
+
* bundled schedule modules that import the same channel get the exact
|
|
28
|
+
* same route object instance.
|
|
29
|
+
*/
|
|
30
|
+
export function registerChannelModuleInCache(absolutePath, moduleDefault) {
|
|
31
|
+
const cache = (globalThis[CHANNEL_MODULE_CACHE_KEY] ??= new Map());
|
|
32
|
+
cache.set(resolve(absolutePath), moduleDefault);
|
|
33
|
+
}
|
|
34
|
+
function getChannelModuleCache() {
|
|
35
|
+
return globalThis[CHANNEL_MODULE_CACHE_KEY];
|
|
36
|
+
}
|
|
20
37
|
/**
|
|
21
38
|
* In-flight load deduplication map keyed by the absolute module path.
|
|
22
39
|
*
|
|
23
|
-
* The compiler walks every authored slot concurrently
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
40
|
+
* The compiler walks every authored slot concurrently
|
|
41
|
+
* (`compileChannelDefinition` and `buildChannelRouteIdentityMap` both
|
|
42
|
+
* load the same channel module via `Promise.all`), so the same module
|
|
43
|
+
* path is frequently loaded twice in parallel. Without dedup, both
|
|
44
|
+
* callers race the bundler write/import pipeline against the
|
|
45
|
+
* same `node_modules/.cache/.../<hash>.mjs` file: one call's
|
|
46
|
+
* `writeFile` can truncate the bundle while another's `import()` is
|
|
47
|
+
* still resolving it, surfacing as intermittent
|
|
29
48
|
* "Expected … to match the public Ash shape" failures during
|
|
30
49
|
* compilation.
|
|
31
50
|
*
|
|
32
51
|
* The map only holds in-flight promises; once a load settles the entry
|
|
33
|
-
* is cleared so subsequent compiles
|
|
34
|
-
* the
|
|
35
|
-
* URL for
|
|
52
|
+
* is cleared so subsequent compiles (e.g. a dev-server reload after
|
|
53
|
+
* the author edits a file) re-run the bundle pipeline against the
|
|
54
|
+
* fresh source. Node's ESM cache then dedupes by content-hashed URL for
|
|
55
|
+
* unchanged files. The companion "skip write when the cache file already
|
|
56
|
+
* exists" check inside {@link loadBundledAuthoredModule} eliminates the
|
|
57
|
+
* write/read race even when two non-concurrent compile passes overlap on
|
|
58
|
+
* the same hashed bundle path.
|
|
36
59
|
*/
|
|
37
60
|
const inFlightModuleLoads = new Map();
|
|
38
61
|
/**
|
|
@@ -74,33 +97,77 @@ function createFileImportSpecifier(modulePath) {
|
|
|
74
97
|
return normalizedPath;
|
|
75
98
|
}
|
|
76
99
|
async function loadBundledAuthoredModule(modulePath) {
|
|
100
|
+
const channelCache = getChannelModuleCache();
|
|
77
101
|
const packageRoot = resolveAuthoredPackageRoot(modulePath);
|
|
78
|
-
const tsconfigPath =
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
102
|
+
const tsconfigPath = resolveAuthoredTsConfigPath(packageRoot);
|
|
103
|
+
const channelIdentityPlugin = channelCache && channelCache.size > 0
|
|
104
|
+
? {
|
|
105
|
+
name: "ash-channel-identity",
|
|
106
|
+
async resolveId(source, importer, options) {
|
|
107
|
+
if (!/channels[/\\]/.test(source) || options.kind !== "import-statement") {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
const resolved = await this.resolve(source, importer, {
|
|
111
|
+
kind: options.kind,
|
|
112
|
+
skipSelf: true,
|
|
113
|
+
});
|
|
114
|
+
if (resolved === null || typeof resolved.id !== "string") {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
const resolvedPath = resolve(resolved.id);
|
|
118
|
+
if (!channelCache.has(resolvedPath)) {
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
return { id: `${CACHED_CHANNEL_PREFIX}${resolvedPath}` };
|
|
122
|
+
},
|
|
123
|
+
load(id) {
|
|
124
|
+
if (!id.startsWith(CACHED_CHANNEL_PREFIX)) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
const cachedPath = id.slice(CACHED_CHANNEL_PREFIX.length);
|
|
128
|
+
return {
|
|
129
|
+
code: [
|
|
130
|
+
`const cache = globalThis["${CHANNEL_MODULE_CACHE_KEY}"];`,
|
|
131
|
+
`export default cache.get(${JSON.stringify(cachedPath)});`,
|
|
132
|
+
].join("\n"),
|
|
133
|
+
moduleType: "js",
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
}
|
|
137
|
+
: null;
|
|
82
138
|
const plugins = [
|
|
139
|
+
createAuthoredAssetImportPlugin(),
|
|
140
|
+
createAuthoredPackageTsConfigPathsPlugin({
|
|
141
|
+
appPackageRoot: packageRoot,
|
|
142
|
+
extensions: RESOLVE_EXTENSIONS,
|
|
143
|
+
}),
|
|
83
144
|
createNodeEsmCompatBannerPlugin({ includeRequire: true }),
|
|
84
145
|
createPackageBoundaryPlugin(packageRoot),
|
|
85
|
-
|
|
146
|
+
channelIdentityPlugin,
|
|
86
147
|
].filter((plugin) => plugin !== null);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
148
|
+
let outputFile;
|
|
149
|
+
try {
|
|
150
|
+
const result = await buildWithNitroRolldown({
|
|
151
|
+
cwd: packageRoot,
|
|
152
|
+
input: modulePath,
|
|
153
|
+
platform: "node",
|
|
154
|
+
plugins,
|
|
155
|
+
resolve: {
|
|
156
|
+
extensions: [...RESOLVE_EXTENSIONS],
|
|
157
|
+
},
|
|
158
|
+
tsconfig: tsconfigPath,
|
|
159
|
+
write: false,
|
|
160
|
+
output: {
|
|
161
|
+
comments: false,
|
|
162
|
+
format: "esm",
|
|
163
|
+
sourcemap: "inline",
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
outputFile = getSingleRolldownChunk(result, `authored module for "${modulePath}"`);
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
throw createAuthoredModuleBundleError(modulePath, error);
|
|
170
|
+
}
|
|
104
171
|
const bundleHash = createHash("sha1")
|
|
105
172
|
.update(modulePath)
|
|
106
173
|
.update("\0")
|
|
@@ -108,12 +175,6 @@ async function loadBundledAuthoredModule(modulePath) {
|
|
|
108
175
|
.digest("hex");
|
|
109
176
|
const bundleDirectoryPath = join(packageRoot, AUTHORED_MODULE_BUNDLE_DIRECTORY_PATH);
|
|
110
177
|
const bundlePath = join(bundleDirectoryPath, `${bundleHash}.mjs`);
|
|
111
|
-
// The bundle filename is the content hash, so if the file already
|
|
112
|
-
// exists it must already hold the correct bytes. Skipping the write
|
|
113
|
-
// avoids re-truncating the file underneath any in-flight `import()`
|
|
114
|
-
// that's still reading the previous compile's bytes. Sync I/O keeps
|
|
115
|
-
// the writer atomic from JS's perspective: nothing else on this
|
|
116
|
-
// event loop can touch the file between mkdir and writeFile.
|
|
117
178
|
if (!existsSync(bundlePath)) {
|
|
118
179
|
mkdirSync(bundleDirectoryPath, { recursive: true });
|
|
119
180
|
writeFileSync(bundlePath, outputFile.code);
|
|
@@ -133,7 +194,11 @@ function createPackageBoundaryPlugin(packageRoot) {
|
|
|
133
194
|
id: source,
|
|
134
195
|
};
|
|
135
196
|
}
|
|
136
|
-
const importerPath = importer === undefined ||
|
|
197
|
+
const importerPath = importer === undefined ||
|
|
198
|
+
importer.startsWith("\0") ||
|
|
199
|
+
importer.startsWith(CACHED_CHANNEL_PREFIX)
|
|
200
|
+
? undefined
|
|
201
|
+
: resolve(importer);
|
|
137
202
|
// Keep package imports authored directly by the app external by
|
|
138
203
|
// default, but let symlinked/file workspace packages compile as
|
|
139
204
|
// source. Those packages often export `.ts` files and rely on the
|
|
@@ -160,91 +225,6 @@ function createPackageBoundaryPlugin(packageRoot) {
|
|
|
160
225
|
},
|
|
161
226
|
};
|
|
162
227
|
}
|
|
163
|
-
function createTsconfigPathAliasPlugin(input) {
|
|
164
|
-
const aliases = readTsconfigPathAliases(input);
|
|
165
|
-
if (aliases.length === 0) {
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
return {
|
|
169
|
-
name: "ash-tsconfig-path-alias",
|
|
170
|
-
resolveId(source) {
|
|
171
|
-
for (const alias of aliases) {
|
|
172
|
-
const matched = matchTsconfigPathAlias(alias.pattern, source);
|
|
173
|
-
if (matched === null) {
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
for (const target of alias.targets) {
|
|
177
|
-
const candidate = resolveTsconfigPathAliasTarget(target, matched);
|
|
178
|
-
if (candidate !== null) {
|
|
179
|
-
return candidate;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return undefined;
|
|
184
|
-
},
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
function readTsconfigPathAliases(input) {
|
|
188
|
-
if (!existsSync(input.tsconfigPath)) {
|
|
189
|
-
return [];
|
|
190
|
-
}
|
|
191
|
-
try {
|
|
192
|
-
const tsconfig = JSON.parse(readFileSync(input.tsconfigPath, "utf8"));
|
|
193
|
-
const paths = tsconfig.compilerOptions?.paths;
|
|
194
|
-
if (paths === null || typeof paths !== "object" || Array.isArray(paths)) {
|
|
195
|
-
return [];
|
|
196
|
-
}
|
|
197
|
-
const baseUrl = typeof tsconfig.compilerOptions?.baseUrl === "string"
|
|
198
|
-
? tsconfig.compilerOptions.baseUrl
|
|
199
|
-
: ".";
|
|
200
|
-
const baseDirectory = resolve(dirname(input.tsconfigPath), baseUrl);
|
|
201
|
-
return Object.entries(paths).flatMap(([pattern, rawTargets]) => {
|
|
202
|
-
if (!Array.isArray(rawTargets)) {
|
|
203
|
-
return [];
|
|
204
|
-
}
|
|
205
|
-
const targets = rawTargets.flatMap((rawTarget) => typeof rawTarget === "string" ? [resolve(baseDirectory, rawTarget)] : []);
|
|
206
|
-
return targets.length === 0 ? [] : [{ pattern, targets }];
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
catch {
|
|
210
|
-
return [];
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
function matchTsconfigPathAlias(pattern, source) {
|
|
214
|
-
const wildcardIndex = pattern.indexOf("*");
|
|
215
|
-
if (wildcardIndex === -1) {
|
|
216
|
-
return pattern === source ? "" : null;
|
|
217
|
-
}
|
|
218
|
-
const prefix = pattern.slice(0, wildcardIndex);
|
|
219
|
-
const suffix = pattern.slice(wildcardIndex + 1);
|
|
220
|
-
if (!source.startsWith(prefix) || !source.endsWith(suffix)) {
|
|
221
|
-
return null;
|
|
222
|
-
}
|
|
223
|
-
return source.slice(prefix.length, source.length - suffix.length);
|
|
224
|
-
}
|
|
225
|
-
function resolveTsconfigPathAliasTarget(targetPattern, matched) {
|
|
226
|
-
const targetPath = targetPattern.replace("*", matched);
|
|
227
|
-
const directMatch = resolveExistingPath(targetPath);
|
|
228
|
-
if (directMatch !== null) {
|
|
229
|
-
return directMatch;
|
|
230
|
-
}
|
|
231
|
-
for (const extension of RESOLVE_EXTENSIONS) {
|
|
232
|
-
const extensionMatch = resolveExistingPath(`${targetPath}${extension}`);
|
|
233
|
-
if (extensionMatch !== null) {
|
|
234
|
-
return extensionMatch;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
for (const extension of RESOLVE_EXTENSIONS) {
|
|
238
|
-
const indexMatch = resolveExistingPath(join(targetPath, `index${extension}`));
|
|
239
|
-
if (indexMatch !== null) {
|
|
240
|
-
return indexMatch;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
return null;
|
|
244
|
-
}
|
|
245
|
-
function resolveExistingPath(path) {
|
|
246
|
-
return existsSync(path) ? path : null;
|
|
247
|
-
}
|
|
248
228
|
function isPackageImport(source) {
|
|
249
229
|
if (source.startsWith(".") || source.startsWith("/") || /^[A-Za-z]:[\\/]/.test(source)) {
|
|
250
230
|
return false;
|
|
@@ -255,7 +235,7 @@ function isPackageImport(source) {
|
|
|
255
235
|
if (source.startsWith("@/")) {
|
|
256
236
|
return false;
|
|
257
237
|
}
|
|
258
|
-
return
|
|
238
|
+
return !source.startsWith(CACHED_CHANNEL_PREFIX);
|
|
259
239
|
}
|
|
260
240
|
function isAshFrameworkImport(source) {
|
|
261
241
|
return source === "experimental-ash" || source.startsWith("experimental-ash/");
|
|
@@ -268,6 +248,15 @@ function isPathInsideOrEqual(path, directory) {
|
|
|
268
248
|
const resolvedDirectory = resolve(directory);
|
|
269
249
|
return (resolvedPath === resolvedDirectory || resolvedPath.startsWith(`${resolvedDirectory}${sep}`));
|
|
270
250
|
}
|
|
251
|
+
function resolveAuthoredTsConfigPath(packageRoot) {
|
|
252
|
+
for (const fileName of ["tsconfig.json", "jsconfig.json"]) {
|
|
253
|
+
const path = join(packageRoot, fileName);
|
|
254
|
+
if (existsSync(path)) {
|
|
255
|
+
return path;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
271
260
|
function resolveAuthoredPackageRoot(modulePath) {
|
|
272
261
|
let currentDirectory = dirname(modulePath);
|
|
273
262
|
while (true) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves tsconfig `paths` for authored source imported from linked
|
|
3
|
+
* workspace packages. Rolldown handles the root app tsconfig; this only
|
|
4
|
+
* fills the package-local config gap for sources outside the app root.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createAuthoredPackageTsConfigPathsPlugin(input: {
|
|
7
|
+
appPackageRoot: string;
|
|
8
|
+
extensions: readonly string[];
|
|
9
|
+
}): Record<string, unknown>;
|