@teacss/bun 0.8.0 → 0.8.1
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/README.md +18 -0
- package/dist/index.js +1 -1
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -45,3 +45,21 @@ metafile, so watch coverage is limited to entries, TeaCSS configuration, and
|
|
|
45
45
|
`@source` roots.
|
|
46
46
|
|
|
47
47
|
Pre-1.0. Source compile-class transformers are not run by this adapter.
|
|
48
|
+
|
|
49
|
+
Watch sessions update source-scanned shortcuts and safelists through file and
|
|
50
|
+
source-root creation, removal, and recreation, including external absolute
|
|
51
|
+
sources. Changes during configuration loading or a build cause another build
|
|
52
|
+
before the session settles.
|
|
53
|
+
|
|
54
|
+
Glob-matched CSS file symlinks observe their physical file targets through
|
|
55
|
+
filtered shallow parent watches, including recovery after a failed member read.
|
|
56
|
+
A bounded declaration check every 500 ms also recovers changes omitted by native
|
|
57
|
+
callbacks; unchanged declarations do not reload configuration or rebuild.
|
|
58
|
+
Nested source directory symlinks observe physical target changes, including empty
|
|
59
|
+
targets and target deletion or recreation. Missing routes use shallow parent
|
|
60
|
+
observation. Failed reads retain the last accepted configuration. An initial
|
|
61
|
+
failed declaration read also keeps its source routes watched, so repairing the
|
|
62
|
+
source can produce the first build without touching the entry. If native watch
|
|
63
|
+
creation fails with `EACCES`, successful desired watches remain active, including
|
|
64
|
+
shallow recovery sentinels. The original error is reported; repeated failure
|
|
65
|
+
alone does not keep retrying.
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AsyncLocalStorage as e}from"node:async_hooks";import{existsSync as t,
|
|
1
|
+
import{AsyncLocalStorage as e}from"node:async_hooks";import{existsSync as t,watch as n}from"node:fs";import{readFile as r,stat as i}from"node:fs/promises";import{dirname as a,isAbsolute as o,resolve as s}from"node:path";import c from"node:process";import{entryDiscoveryFiles as l}from"@teacss/config";import{SourceWatchRegistry as u,createSourceDeclarationCheck as d,planSourceWatches as f,probeSourceDeclarations as p,scanSourceFiles as m,sourceDeclarationStateOf as h,sourceDeclarationWatchTargets as ee,sourceWatchTargets as g}from"@teacss/config/internal/source-scan";import _ from"@teacss/directives";import{applyTransformerPipeline as v,createContext as y,defaultFilesystemGlobs as b}from"@teacss/runtime";import{DEFAULT_SOURCE_IGNORE as x,generateSources as S,readSourceFile as C}from"@teacss/runtime/source-generation";function te(e,t,n=Bun.version){let r={...e};return delete r.metafile,Bun.semver.satisfies(n,`>=1.3.6`)&&(r.metafile=!0),{...r,plugins:t}}const w=/^(?:virtual:)?teacss\.css$/,ne=/\.css$/,T=`teacss`;function E(e){return e===void 0?{globs:b,ignore:x}:{globs:e,ignore:[]}}function re(e,t={}){return{name:`teacss`,async setup(n){let i=y(e,{...t,transformers:[...t.transformers??[],_()]}),o=n.config.root??c.cwd();await i.updateRoot(o);let s=new Set,l=new Set,u=!0;function d(){let e=i.getConfigFileList()[0];return e?a(e):o}async function f(e){let t=e();s.add(t);try{return await t}finally{s.delete(t)}}n.onStart(async()=>{if(u){u=!1;return}await Promise.allSettled(s);for(let e of l)await i.extract(``,e);l.clear(),await i.reloadConfig()}),n.onResolve({filter:w},()=>({path:`teacss.css`,namespace:T})),n.onLoad({filter:/.*/,namespace:T},()=>f(async()=>{let{globs:e,ignore:t}=E((await i.getConfig()).content?.filesystem),n=await m(e,{cwd:d(),ignore:t,expandDirectories:!0}),r=n.map(C),{css:a}=await S(i.generator,n,r,{minify:!1});return{contents:a,loader:`css`}})),n.onLoad({filter:ne},e=>f(async()=>{let t=await r(e.path,`utf8`);return l.add(e.path),{contents:(await v(i,t,e.path))?.code??t,loader:`css`}}))}}}function ie(e){return`${e.mtimeMs}:${e.ctimeMs}:${e.size}:${e.ino}`}async function D(r,_={}){let v=s(r.root??c.cwd()),x=r.entrypoints.map(e=>o(e)?e:s(v,e)),{configOrPath:S,defaults:C={},debounce:w=50,onBuild:ne,onError:T}=_,D=y(S,C),O=new Set,k=!1,A=!1,ae,j,M=!1,N,P=!1,F=!1,I=0,L=!1,oe=``,R=new Set,z,B,V=0,H=new Set,U=new e;function W(){let e=D.getConfigFileList()[0];return e?a(e):v}async function G(){let{globs:e,ignore:t}=E(D.generator.config.content?.filesystem);return await m(e,{cwd:W(),ignore:t,expandDirectories:!0})}function se(e){let t=e.content?.filesystem;if(!t)return e;let n=W();return{...e,content:{...e.content,filesystem:t.map(e=>e.startsWith(`!`)?`!${s(n,e.slice(1))}`:s(n,e))}}}function K(e,t,n){if(!t)return Promise.resolve();let r={active:!0},i;return i=U.run(r,()=>Promise.resolve().then(()=>t(n)).catch(t=>console.error(`[@teacss/bun] watch ${e} callback failed:`,t)).finally(()=>{r.active=!1,H.delete(i)})),H.add(i),i}async function ce(){for(;H.size>0;)await Promise.all(H)}function q(e){return A?Promise.resolve():(z=e,K(`error`,T,e))}function le(e,t=O){let n=[...D.getConfigFileList(),...x,...t,...e].map(e=>({kind:`exact`,path:e}));if(typeof S!=`object`){let e=typeof S==`string`?s(v,S):v;if(e.endsWith(`.css`))n.push({kind:`exact`,path:e});else for(let t of l)n.push({kind:`exact`,path:s(e,t)})}return n.push(...g(D.generator.config.content?.filesystem??b,W(),!0)),n.push(...ee(h(D))),n}function J(e,t=O){return new Set([...D.getConfigFileList(),...x,...t,...e])}async function Y(e){let t=new Set(e.flatMap(e=>[...e])),n=new Map(await Promise.all([...t].map(async e=>{try{return[e,`${e}:${ie(await i(e))}`]}catch(t){if(t.code===`ENOENT`)return[e,`${e}:missing`];throw t}})));return e.map(e=>[...e].sort().map(e=>n.get(e)).join(`|`))}async function ue(e,t=O){return(await Y([J(e,t)]))[0]}let de=new u((e,t,r)=>n(e,{recursive:r},t),e=>{if(e!==void 0&&R.has(e)&&I++,!P){F=!0;return}$()},e=>{q(e)});function X(e,t=O){de.reconcile(f(le(e,t))),R=J(e,t)}function fe(e,t,n){return AggregateError([e,t],n)}function pe(e,n){return new Set(Object.keys(e.metafile?.inputs??{}).map(e=>o(e)?e:s(v,e)).filter(e=>!n||t(e)))}let Z,Q;async function me(e,t=O){if(A)return;let n=e,r=[];try{r=await G()}catch(e){n=fe(n,e,`TeaCSS build and source discovery failed`)}if(!A){try{X(r,t);let e=h(D),n=await p(e,!0,Z);Q=n,(await p(e)).signature!==n.signature&&(L=!0,P?M=!0:F=!0)}catch(e){n=fe(n,e,`TeaCSS build and watcher reconciliation failed`)}await q(n)}}async function he(){if(A)return;Z=await p(h(D));let e=I,t=new Set(R),[n]=await Y([t]);if(k?await D.reloadConfig():(k=!0,await D.updateRoot(v)),A)return;let i=await G();if(A||(X(i),A))return;let a=h(D),o=await p(a,!0,Z);Q=o;let s=await p(a),c=o.signature!==s.signature,[l]=await Y([t]),u=n!==l||c,d=await ue(i);if(A)return;let f=L;if(L=!1,!f&&!u&&V>0&&z===void 0&&d===oe)return;let m=se(await D.getConfig());if(A)return;let ee=[...(r.plugins??[]).filter(e=>e.name!==`teacss`),re(m)],g=await Bun.build(te(r,ee));if(A)return;if(!g.success){await me(g,new Set([...O,...pe(g,!1)]));return}let _=pe(g,!0),y=await G();if(A)return;let b=[..._].some(e=>!R.has(e));if(X(y,_),A)return;let[x,S]=await Y([J(y),J(y,_)]);if(A)return;let C=await p(a),w=u||o?.signature!==C?.signature||b||x!==d||I!==e;B=g,z=void 0,V++,O=_,oe=S,await K(`build`,ne,g),w&&(L=!0,P?M=!0:F=!0)}async function ge(){try{await he()}catch(e){await me(e)}}async function _e(){do M=!1,await ge();while(M&&!A)}function $(){A||(j&&clearTimeout(j),j=setTimeout(()=>{j=void 0,M=!0,N||=_e().finally(()=>{N=void 0,M&&!A&&$()})},w))}function ve(){A=!0,ye.retire(),j&&clearTimeout(j),j=void 0,de.retire()}await ge(),P=!0;let ye=d(()=>h(D),async e=>{A||j||M||e.signature===Q?.signature||(N?M=!0:$())},q);return F&&$(),{get error(){return z},get result(){return B},get version(){return V},dispose(){return U.getStore()?.active?(ve(),Promise.resolve()):(ae??=(async()=>{ve(),await ye.close(),await N,await ce()})(),ae)}}}export{re as pluginTeacss,D as watchTeacssBuild};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teacss/bun",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Bun plugin for TeaCSS — generate utilities and inline @apply via Bun.build.",
|
|
5
5
|
"homepage": "https://css.teasim.com",
|
|
6
6
|
"funding": "https://github.com/sponsors/billgo",
|
|
@@ -22,13 +22,14 @@
|
|
|
22
22
|
"dev": "tsdown --watch"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@teacss/
|
|
26
|
-
"@teacss/
|
|
27
|
-
"@teacss/
|
|
25
|
+
"@teacss/config": "0.8.1",
|
|
26
|
+
"@teacss/core": "0.8.1",
|
|
27
|
+
"@teacss/directives": "0.8.1",
|
|
28
|
+
"@teacss/runtime": "0.8.1",
|
|
28
29
|
"tinyglobby": "^0.2.17"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@teacss/preset-standard": "0.8.
|
|
32
|
+
"@teacss/preset-standard": "0.8.1",
|
|
32
33
|
"bun-types": "^1.4.1",
|
|
33
34
|
"consola": "^3.4.2"
|
|
34
35
|
},
|