@teacss/bun 0.10.13 → 0.10.14

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.
Files changed (2) hide show
  1. package/dist/index.js +0 -15
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -7,15 +7,8 @@ const VIRTUAL_ENTRY = /^(?:virtual:)?teacss\.css$/;
7
7
  const MODULE = /\.(?:[cm]?[jt]sx?|html)$/;
8
8
  const CSS = /\.css$/;
9
9
  const NODE_MODULES = `${sep}node_modules${sep}`;
10
- // teacss-ts `rewriteBundledAssets` writes each bundled font as `teacss-fonts/teacss-<sha256>.woff2` beside the CSS.
11
10
  const FONT_URL_PREFIX = "./teacss-fonts/teacss-";
12
11
  const FONT_URL = /^\.\/teacss-fonts\/teacss-[a-f0-9]{64}\.woff2$/;
13
- /**
14
- * The tokens of each `@source` module that `transformSource` rewrites: a `:css:` group becomes a class whose
15
- * definition the engine now holds, the same rewrite `onLoad` returns to Bun. Bun may ask for the stylesheet
16
- * before it loads the module, so the stylesheet cannot wait for `onLoad`. A module `transformSource` leaves as
17
- * it is has the tokens `extractFilesUnion` read from its file.
18
- */
19
12
  function compiledClasses(project, unreadable) {
20
13
  const { engine } = project;
21
14
  const tokens = [];
@@ -28,10 +21,6 @@ function compiledClasses(project, unreadable) {
28
21
  }
29
22
  return tokens;
30
23
  }
31
- /**
32
- * The tokens of every `@source` file read once and of `inline.content.inline`. `warned` holds the
33
- * unreadable-directory and unmatched-token warnings already printed by earlier builds of the same plugin.
34
- */
35
24
  function generateCss(project, minify, warned) {
36
25
  const warnOnce = (message) => {
37
26
  if (warned.has(message))
@@ -82,8 +71,6 @@ function projectRoot(options, config) {
82
71
  * plugin emits the stylesheet unminified.
83
72
  */
84
73
  export function teacss(options = {}) {
85
- // `watch()` runs every build through this one plugin; each build gets a fresh project, so that no module or
86
- // compile-class definition of a file deleted or renamed since lingers, and the warnings outlive it here.
87
74
  const warned = new Set();
88
75
  return {
89
76
  name: PLUGIN,
@@ -93,7 +80,6 @@ export function teacss(options = {}) {
93
80
  const externalize = build.config.outdir ? (css) => externalizeFonts(css, fonts) : (css) => css;
94
81
  const generated = () => externalize(generateCss(project, options.minify ?? false, warned));
95
82
  build.onResolve({ filter: VIRTUAL_ENTRY }, () => ({ path: "teacss.css", namespace: PLUGIN }));
96
- // Bun bundles every `url()` of a stylesheet; the fonts exist only after `onEnd` writes them.
97
83
  build.onResolve({ filter: FONT_URL }, (args) => (fonts.has(args.path.slice(FONT_URL_PREFIX.length, -".woff2".length)) ? { path: args.path, external: true } : undefined));
98
84
  build.onLoad({ filter: /.*/, namespace: PLUGIN }, () => ({ contents: generated(), loader: "css" }));
99
85
  build.onLoad({ filter: CSS }, async (args) => {
@@ -104,7 +90,6 @@ export function teacss(options = {}) {
104
90
  const code = await readFile(args.path, "utf8");
105
91
  if (args.path.includes(NODE_MODULES) && !code.includes("@teacss-include"))
106
92
  return;
107
- // The stylesheet reads the `@source` files itself, so the module's tokens are not registered with the engine.
108
93
  const transformed = project.engine.transformSource(args.path, code);
109
94
  return transformed ? { contents: transformed.code, loader: args.loader } : undefined;
110
95
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teacss/bun",
3
- "version": "0.10.13",
3
+ "version": "0.10.14",
4
4
  "description": "Bun.build plugin for TeaCSS: virtual:teacss.css and the entry's @teacss become the CSS the Rust engine generates",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  "node": ">=26"
32
32
  },
33
33
  "dependencies": {
34
- "@teacss/engine": "0.10.13"
34
+ "@teacss/engine": "0.10.14"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/bun": "1.4.3",