@bamboocss/node 1.59.0 → 1.60.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/dist/index.cjs CHANGED
@@ -5986,10 +5986,17 @@ var Builder = class {
5986
5986
  * Later calls stay narrow, which is what the guard was reaching for. A watch rebuild re-emits
5987
5987
  * only the artifacts a config change affected, and a rebuild that changed no config writes
5988
5988
  * nothing at all.
5989
+ *
5990
+ * Unless the output directory is gone: the flag says this builder wrote the artifacts once, not
5991
+ * that they are still there. A process running several builds with the same plugin instances,
5992
+ * and cleaning `styled-system/` between them, failed every build after the first on
5993
+ * `Could not load styled-system/css`.
5989
5994
  */
5990
5995
  async emit() {
5991
- if (!this.hasEmitted) {
5992
- _bamboocss_logger.logger.debug("builder", "Emit artifacts");
5996
+ const ctx = this.context;
5997
+ const gone = this.hasEmitted && ctx !== void 0 && !(0, node_fs.existsSync)(ctx.runtime.path.join(...ctx.paths.root));
5998
+ if (!this.hasEmitted || gone) {
5999
+ _bamboocss_logger.logger.debug("builder", gone ? "Emit artifacts, the output directory having been removed" : "Emit artifacts");
5993
6000
  await codegen(this.getContextOrThrow());
5994
6001
  } else if (this.affecteds?.hasConfigChanged) {
5995
6002
  _bamboocss_logger.logger.debug("builder", "Emit artifacts after config change");
package/dist/index.d.cts CHANGED
@@ -45,9 +45,30 @@ interface FoldSelection {
45
45
  }
46
46
  interface FoldCxArgument {
47
47
  span: FoldSpan;
48
- kind: 'string' | 'ignored' | 'array' | 'expression' | 'spread';
48
+ /**
49
+ * `binding` is a module-scope `const` initialised with a `css()` or pattern call, here or in a
50
+ * module this one imports it from. `when` is `test && value`, `choose` is `test ? a : b`.
51
+ */
52
+ kind: 'string' | 'ignored' | 'array' | 'binding' | 'when' | 'choose' | 'expression' | 'spread';
49
53
  value?: string;
54
+ /** For `array`, its elements; for `when`, the value; for `choose`, the consequent then the alternate. */
50
55
  elements?: FoldCxArgument[];
56
+ /**
57
+ * For `when` and `choose`: the condition, as written. Never one reading a Bamboo binding or a
58
+ * recipe, since the fold copies it into what it writes.
59
+ */
60
+ test?: FoldSpan;
61
+ /** For a `binding` declared in this module: the style call it is initialised with. */
62
+ definition?: FoldSpan;
63
+ /** For a `binding` imported from another module: the local name `importedStyles` is keyed by. */
64
+ binding?: string;
65
+ /**
66
+ * For an argument of the call itself: its whole span, wrappers and parentheses included — what the
67
+ * fold copies when it leaves the argument to the runtime join. `span` is what the argument holds.
68
+ */
69
+ written?: FoldSpan;
70
+ /** For an argument of the call itself: it reads a Bamboo binding or a recipe, so it cannot be copied. */
71
+ readsBamboo: boolean;
51
72
  }
52
73
  interface FoldCall {
53
74
  name: string;
@@ -81,8 +102,9 @@ interface FoldCall {
81
102
  */
82
103
  guarded: boolean;
83
104
  /**
84
- * A `token.value()` call written first in an expression statement. What replaces it there cannot
85
- * open with `(` or `-`, which would continue the line before it where that line has no semicolon.
105
+ * A `token.value()` or `cx()` call written first in an expression statement. What replaces it there
106
+ * cannot open with `(` or `-`, which would continue the line before it where that line has no
107
+ * semicolon.
86
108
  */
87
109
  statementStart: boolean;
88
110
  }
@@ -154,6 +176,20 @@ interface FoldAnalysis {
154
176
  declaringImports: string[];
155
177
  dependencies: string[];
156
178
  }>;
179
+ /**
180
+ * Imports a `cx()` argument names that resolve to an exact `css()` or pattern call bound at module
181
+ * scope in another module: `kind` is `css` or `pattern`, `callee` the function called, `data` its
182
+ * evaluated arguments, `dependencies` every module a composition against it depends on.
183
+ */
184
+ importedStyles: Array<{
185
+ local: string;
186
+ filePath: string;
187
+ name: string;
188
+ kind: 'css' | 'pattern';
189
+ callee: string;
190
+ data: unknown[];
191
+ dependencies: string[];
192
+ }>;
157
193
  dependencies: string[];
158
194
  /**
159
195
  * Bamboo bindings a `<script setup>` compiled for a separate render function exposes to its
@@ -987,6 +1023,11 @@ declare class Builder {
987
1023
  * Later calls stay narrow, which is what the guard was reaching for. A watch rebuild re-emits
988
1024
  * only the artifacts a config change affected, and a rebuild that changed no config writes
989
1025
  * nothing at all.
1026
+ *
1027
+ * Unless the output directory is gone: the flag says this builder wrote the artifacts once, not
1028
+ * that they are still there. A process running several builds with the same plugin instances,
1029
+ * and cleaning `styled-system/` between them, failed every build after the first on
1030
+ * `Could not load styled-system/css`.
990
1031
  */
991
1032
  emit(): Promise<void>;
992
1033
  setupContext: (options: SetupContextOptions) => Promise<BambooContext>;
package/dist/index.d.mts CHANGED
@@ -45,9 +45,30 @@ interface FoldSelection {
45
45
  }
46
46
  interface FoldCxArgument {
47
47
  span: FoldSpan;
48
- kind: 'string' | 'ignored' | 'array' | 'expression' | 'spread';
48
+ /**
49
+ * `binding` is a module-scope `const` initialised with a `css()` or pattern call, here or in a
50
+ * module this one imports it from. `when` is `test && value`, `choose` is `test ? a : b`.
51
+ */
52
+ kind: 'string' | 'ignored' | 'array' | 'binding' | 'when' | 'choose' | 'expression' | 'spread';
49
53
  value?: string;
54
+ /** For `array`, its elements; for `when`, the value; for `choose`, the consequent then the alternate. */
50
55
  elements?: FoldCxArgument[];
56
+ /**
57
+ * For `when` and `choose`: the condition, as written. Never one reading a Bamboo binding or a
58
+ * recipe, since the fold copies it into what it writes.
59
+ */
60
+ test?: FoldSpan;
61
+ /** For a `binding` declared in this module: the style call it is initialised with. */
62
+ definition?: FoldSpan;
63
+ /** For a `binding` imported from another module: the local name `importedStyles` is keyed by. */
64
+ binding?: string;
65
+ /**
66
+ * For an argument of the call itself: its whole span, wrappers and parentheses included — what the
67
+ * fold copies when it leaves the argument to the runtime join. `span` is what the argument holds.
68
+ */
69
+ written?: FoldSpan;
70
+ /** For an argument of the call itself: it reads a Bamboo binding or a recipe, so it cannot be copied. */
71
+ readsBamboo: boolean;
51
72
  }
52
73
  interface FoldCall {
53
74
  name: string;
@@ -81,8 +102,9 @@ interface FoldCall {
81
102
  */
82
103
  guarded: boolean;
83
104
  /**
84
- * A `token.value()` call written first in an expression statement. What replaces it there cannot
85
- * open with `(` or `-`, which would continue the line before it where that line has no semicolon.
105
+ * A `token.value()` or `cx()` call written first in an expression statement. What replaces it there
106
+ * cannot open with `(` or `-`, which would continue the line before it where that line has no
107
+ * semicolon.
86
108
  */
87
109
  statementStart: boolean;
88
110
  }
@@ -154,6 +176,20 @@ interface FoldAnalysis {
154
176
  declaringImports: string[];
155
177
  dependencies: string[];
156
178
  }>;
179
+ /**
180
+ * Imports a `cx()` argument names that resolve to an exact `css()` or pattern call bound at module
181
+ * scope in another module: `kind` is `css` or `pattern`, `callee` the function called, `data` its
182
+ * evaluated arguments, `dependencies` every module a composition against it depends on.
183
+ */
184
+ importedStyles: Array<{
185
+ local: string;
186
+ filePath: string;
187
+ name: string;
188
+ kind: 'css' | 'pattern';
189
+ callee: string;
190
+ data: unknown[];
191
+ dependencies: string[];
192
+ }>;
157
193
  dependencies: string[];
158
194
  /**
159
195
  * Bamboo bindings a `<script setup>` compiled for a separate render function exposes to its
@@ -987,6 +1023,11 @@ declare class Builder {
987
1023
  * Later calls stay narrow, which is what the guard was reaching for. A watch rebuild re-emits
988
1024
  * only the artifacts a config change affected, and a rebuild that changed no config writes
989
1025
  * nothing at all.
1026
+ *
1027
+ * Unless the output directory is gone: the flag says this builder wrote the artifacts once, not
1028
+ * that they are still there. A process running several builds with the same plugin instances,
1029
+ * and cleaning `styled-system/` between them, failed every build after the first on
1030
+ * `Could not load styled-system/css`.
990
1031
  */
991
1032
  emit(): Promise<void>;
992
1033
  setupContext: (options: SetupContextOptions) => Promise<BambooContext>;
package/dist/index.mjs CHANGED
@@ -5974,10 +5974,17 @@ var Builder = class {
5974
5974
  * Later calls stay narrow, which is what the guard was reaching for. A watch rebuild re-emits
5975
5975
  * only the artifacts a config change affected, and a rebuild that changed no config writes
5976
5976
  * nothing at all.
5977
+ *
5978
+ * Unless the output directory is gone: the flag says this builder wrote the artifacts once, not
5979
+ * that they are still there. A process running several builds with the same plugin instances,
5980
+ * and cleaning `styled-system/` between them, failed every build after the first on
5981
+ * `Could not load styled-system/css`.
5977
5982
  */
5978
5983
  async emit() {
5979
- if (!this.hasEmitted) {
5980
- logger.debug("builder", "Emit artifacts");
5984
+ const ctx = this.context;
5985
+ const gone = this.hasEmitted && ctx !== void 0 && !existsSync(ctx.runtime.path.join(...ctx.paths.root));
5986
+ if (!this.hasEmitted || gone) {
5987
+ logger.debug("builder", gone ? "Emit artifacts, the output directory having been removed" : "Emit artifacts");
5981
5988
  await codegen(this.getContextOrThrow());
5982
5989
  } else if (this.affecteds?.hasConfigChanged) {
5983
5990
  logger.debug("builder", "Emit artifacts after config change");
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/node",
3
- "version": "1.59.0",
3
+ "version": "1.60.1",
4
4
  "description": "The core css bamboo library",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -60,16 +60,16 @@
60
60
  "pkg-types": "2.3.0",
61
61
  "pluralize": "8.0.0",
62
62
  "ts-pattern": "5.9.0",
63
- "@bamboocss/config": "1.59.0",
64
- "@bamboocss/core": "1.59.0",
65
- "@bamboocss/generator": "1.59.0",
66
- "@bamboocss/logger": "1.59.0",
67
- "@bamboocss/plugin-svelte": "1.59.0",
68
- "@bamboocss/plugin-vue": "1.59.0",
69
- "@bamboocss/reporter": "1.59.0",
70
- "@bamboocss/shared": "1.59.0",
71
- "@bamboocss/token-dictionary": "1.59.0",
72
- "@bamboocss/types": "1.59.0"
63
+ "@bamboocss/config": "1.60.1",
64
+ "@bamboocss/core": "1.60.1",
65
+ "@bamboocss/generator": "1.60.1",
66
+ "@bamboocss/logger": "1.60.1",
67
+ "@bamboocss/plugin-svelte": "1.60.1",
68
+ "@bamboocss/plugin-vue": "1.60.1",
69
+ "@bamboocss/reporter": "1.60.1",
70
+ "@bamboocss/shared": "1.60.1",
71
+ "@bamboocss/token-dictionary": "1.60.1",
72
+ "@bamboocss/types": "1.60.1"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@astrojs/compiler": "3.0.1",
@@ -77,7 +77,7 @@
77
77
  "@types/fs-extra": "11.0.4",
78
78
  "@types/picomatch": "4.0.2",
79
79
  "boxen": "8.0.1",
80
- "@bamboocss/native-extractor": "1.59.0"
80
+ "@bamboocss/native-extractor": "1.60.1"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "@astrojs/compiler": ">=2",