@uniflowed/host 0.0.0-alpha.6 → 0.0.0-alpha.7
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/package.json +1 -1
- package/transform.js +18 -4
package/package.json
CHANGED
package/transform.js
CHANGED
|
@@ -229,10 +229,13 @@ export class TransformService {
|
|
|
229
229
|
/**
|
|
230
230
|
* Transform one module.
|
|
231
231
|
*
|
|
232
|
-
* Resolves to `{ code, map, diagnostics }`, or to `null` when the
|
|
233
|
-
* not uf's to transform (see `isFlowModule`). Rejects with a
|
|
232
|
+
* Resolves to `{ code, map, css, diagnostics }`, or to `null` when the
|
|
233
|
+
* module is not uf's to transform (see `isFlowModule`). Rejects with a
|
|
234
234
|
* `TransformError` carrying the position when the source is not valid Flow.
|
|
235
235
|
*
|
|
236
|
+
* `css` is the stylesheet the module's StyleX rules declare, and `null` when
|
|
237
|
+
* it declares none.
|
|
238
|
+
*
|
|
236
239
|
* @param {string} id absolute path, used for the map and for errors
|
|
237
240
|
* @param {string} code the Flow source
|
|
238
241
|
* @param {object} [options]
|
|
@@ -251,9 +254,20 @@ export class TransformService {
|
|
|
251
254
|
resolve(null);
|
|
252
255
|
return;
|
|
253
256
|
}
|
|
257
|
+
// Named field by field rather than passed through, so a host reads
|
|
258
|
+
// the protocol rather than whatever `uf transform` happens to send —
|
|
259
|
+
// which means every field the protocol grows has to be added here,
|
|
260
|
+
// and one was not. `css` arrived with the StyleX compiler and this
|
|
261
|
+
// object did not mention it, so `out.css` was `undefined` in every
|
|
262
|
+
// host: the Vite plugin's `if (out.css != null)` never ran, no module
|
|
263
|
+
// ever imported its own stylesheet, and an application styled with
|
|
264
|
+
// `stylex.create` shipped class names and no CSS. The transform was
|
|
265
|
+
// right the whole time; the shim in front of it was returning three
|
|
266
|
+
// quarters of the answer. See ubugeeei-prod/uf#306.
|
|
254
267
|
resolve({
|
|
255
268
|
code: reply.code,
|
|
256
269
|
map: reply.map ?? null,
|
|
270
|
+
css: reply.css ?? null,
|
|
257
271
|
diagnostics: reply.diagnostics ?? [],
|
|
258
272
|
});
|
|
259
273
|
},
|
|
@@ -300,8 +314,8 @@ export function sharedService(root) {
|
|
|
300
314
|
/**
|
|
301
315
|
* Transform one Flow module through the shared service.
|
|
302
316
|
*
|
|
303
|
-
* Returns `{ code, map, diagnostics }`; a module that is not uf's to
|
|
304
|
-
* comes back as `null`.
|
|
317
|
+
* Returns `{ code, map, css, diagnostics }`; a module that is not uf's to
|
|
318
|
+
* transform comes back as `null`.
|
|
305
319
|
*/
|
|
306
320
|
export function transformFlow(code, filename, options = {}) {
|
|
307
321
|
return sharedService(options.root).transform(filename, code, options);
|