@fluixi/compiler 1.0.0-alpha.94 → 1.0.0-alpha.95
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/LICENSE +1 -1
- package/dist/analyze/static-graph.cjs +1 -1
- package/dist/analyze/static-graph.mjs +1 -1
- package/dist/{babel-RJFQVFJW.mjs → babel-V33QLJBF.mjs} +4 -4
- package/dist/{chunk-DP2QDWWH.mjs → chunk-62F2LLBM.mjs} +1 -1
- package/dist/{chunk-E2RWTIYE.mjs → chunk-7GNSGUHK.mjs} +4 -89
- package/dist/{chunk-ZR2QHTEX.mjs → chunk-B64LVPTU.mjs} +2 -2
- package/dist/{chunk-HCCBEJEZ.mjs → chunk-C3AK5PBV.mjs} +1 -1
- package/dist/{chunk-HIZU7WI2.mjs → chunk-GLFUPZ27.mjs} +1 -1
- package/dist/chunk-HUABRVWB.mjs +92 -0
- package/dist/chunk-XCWP7WJG.mjs +584 -0
- package/dist/frontend/babel/index.cjs +1 -1
- package/dist/frontend/babel/index.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/integrations.cjs +3328 -3269
- package/dist/integrations.d.ts.map +1 -1
- package/dist/integrations.js +19 -8
- package/dist/integrations.mjs +85 -40
- package/dist/lower/compile-template.cjs +1 -1
- package/dist/lower/compile-template.mjs +1 -1
- package/dist/resolve/builtins.cjs +1 -1
- package/dist/resolve/builtins.mjs +1 -1
- package/dist/{server-fns-JLSTKWPS.mjs → server-fns-N3SDJXA7.mjs} +5 -4
- package/dist/{server-functions-BGY3RD4R.mjs → server-functions-LVS66Q4R.mjs} +3 -3
- package/dist/transform/index.cjs +31 -14
- package/dist/transform/index.mjs +31 -14
- package/dist/transform/styles.cjs +31 -13
- package/dist/transform/styles.d.cts +27 -1
- package/dist/transform/styles.d.ts +27 -1
- package/dist/transform/styles.d.ts.map +1 -1
- package/dist/transform/styles.js +45 -16
- package/dist/transform/styles.mjs +31 -13
- package/dist/transform/templates.cjs +30 -13
- package/dist/transform/templates.mjs +30 -13
- package/dist/{transform-GBP6Y4UI.mjs → transform-P4AETYV4.mjs} +12 -563
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/vite-styles.cjs +66 -23
- package/dist/vite-styles.d.cts +16 -7
- package/dist/vite-styles.d.ts +16 -7
- package/dist/vite-styles.d.ts.map +1 -1
- package/dist/vite-styles.js +68 -25
- package/dist/vite-styles.mjs +78 -23
- package/package.json +4 -4
|
@@ -1135,7 +1135,7 @@ function collectStyles(program, sourceName, options, tags = { html: /* @__PURE__
|
|
|
1135
1135
|
const imported = literalsOf.imports.get(name);
|
|
1136
1136
|
if (imported) {
|
|
1137
1137
|
const nodes = options?.imported?.get(`${imported.source}#${imported.name}`);
|
|
1138
|
-
if (nodes) return nodes.map(
|
|
1138
|
+
if (nodes) return nodes.map((n2) => keepLocIn(n2, options?.importedModules));
|
|
1139
1139
|
plan.references.push({ name: imported.name, source: imported.source, ...at });
|
|
1140
1140
|
plan.diagnostics.push({
|
|
1141
1141
|
...at,
|
|
@@ -1159,7 +1159,7 @@ function collectStyles(program, sourceName, options, tags = { html: /* @__PURE__
|
|
|
1159
1159
|
const nodes = resolveLiteral(name, at, []);
|
|
1160
1160
|
const id = hash(`${sourceName}:css:${name}`);
|
|
1161
1161
|
plan.edits.push({ start: literal.start, end: literal.end, code: `({ $fxStyle: ${JSON.stringify(id)} })` });
|
|
1162
|
-
if (nodes) plan.literals.push({ id, name, css: printStyle(nodes, options.minify) });
|
|
1162
|
+
if (nodes) plan.literals.push({ id, name, css: printStyle(nodes, options.minify), nodes });
|
|
1163
1163
|
}
|
|
1164
1164
|
const scopeOf = /* @__PURE__ */ new Map();
|
|
1165
1165
|
const names = /* @__PURE__ */ new Map();
|
|
@@ -1234,7 +1234,7 @@ function collectStyles(program, sourceName, options, tags = { html: /* @__PURE__
|
|
|
1234
1234
|
if (!plan.scopes.some((s) => s.value === id)) plan.scopes.push({ start: owner.start, end: owner.end, value: id });
|
|
1235
1235
|
nodes = scopeNodes(nodes, id, (message) => plan.diagnostics.push({ ...at, message }));
|
|
1236
1236
|
}
|
|
1237
|
-
const printed = module ? printStyleWithMap(nodes, options.minify, sourceName, module) : { css: printStyle(nodes, options.minify) };
|
|
1237
|
+
const printed = module ? printStyleWithMap(nodes, options.minify, sourceName, module, options.importedModules) : { css: printStyle(nodes, options.minify) };
|
|
1238
1238
|
plan.styles.push({ id, scoped: scoped && !shadow, component, ...printed, ...shadow ? { shadow: true } : {}, ...at });
|
|
1239
1239
|
if (shadow) shadow.indexes.push(plan.styles.length - 1);
|
|
1240
1240
|
};
|
|
@@ -1273,6 +1273,11 @@ function staticMember(cls, name) {
|
|
|
1273
1273
|
(m) => m.type === "ClassProperty" && m.static && (m.key.type === "Identifier" && m.key.name === name || m.key.type === "StringLiteral" && m.key.value === name)
|
|
1274
1274
|
);
|
|
1275
1275
|
}
|
|
1276
|
+
var styleIds = {
|
|
1277
|
+
block: (owner, index) => `${owner}.fx-${index}.css`,
|
|
1278
|
+
inline: (owner, index) => `${owner}.fx-${index}.css?inline`,
|
|
1279
|
+
literal: (owner, name) => `${owner}.fx-literal-${name}.css?inline`
|
|
1280
|
+
};
|
|
1276
1281
|
function finishShadowStyles(plan, code, moduleId) {
|
|
1277
1282
|
const edits = [];
|
|
1278
1283
|
const imports = [];
|
|
@@ -1284,7 +1289,7 @@ function finishShadowStyles(plan, code, moduleId) {
|
|
|
1284
1289
|
return local;
|
|
1285
1290
|
};
|
|
1286
1291
|
for (const shadow of plan.shadowClasses.values()) {
|
|
1287
|
-
const blocks = shadow.indexes.map((i) => importOf(
|
|
1292
|
+
const blocks = shadow.indexes.map((i) => importOf(styleIds.inline(moduleId, i)));
|
|
1288
1293
|
let value;
|
|
1289
1294
|
const prop = shadow.styles;
|
|
1290
1295
|
if (prop?.value) {
|
|
@@ -1292,7 +1297,7 @@ function finishShadowStyles(plan, code, moduleId) {
|
|
|
1292
1297
|
let text = code.slice(start, prop.value.end);
|
|
1293
1298
|
const replacements = [];
|
|
1294
1299
|
walkIdentifiers(prop.value, (id) => {
|
|
1295
|
-
const local = plan.names?.literals.has(id.name) ? importOf(
|
|
1300
|
+
const local = plan.names?.literals.has(id.name) ? importOf(styleIds.literal(moduleId, id.name)) : plan.names?.imports.has(id.name) && !/\.css(\?|$)/.test(plan.names.imports.get(id.name).source) ? importOf(styleIds.literal(plan.names.imports.get(id.name).source, plan.names.imports.get(id.name).name)) : void 0;
|
|
1296
1301
|
if (local) replacements.push({ at: id.start - start, length: id.name.length, with: local });
|
|
1297
1302
|
});
|
|
1298
1303
|
for (const r of replacements.sort((a, b) => b.at - a.at)) text = text.slice(0, r.at) + r.with + text.slice(r.at + r.length);
|
|
@@ -1574,12 +1579,23 @@ function shiftLoc(node, source, start) {
|
|
|
1574
1579
|
if (node.kind === "rule" || node.kind === "at-rule") return { ...node, loc, nodes: node.nodes.map((n2) => shiftLoc(n2, source, start)) };
|
|
1575
1580
|
return { ...node, loc };
|
|
1576
1581
|
}
|
|
1577
|
-
function
|
|
1578
|
-
const
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1582
|
+
function keepLocIn(node, modules) {
|
|
1583
|
+
const keep = node.loc !== void 0 && modules?.has(node.loc.source) === true;
|
|
1584
|
+
const { loc, ...rest } = node;
|
|
1585
|
+
const kept = keep ? { ...rest, loc } : rest;
|
|
1586
|
+
if (kept.kind === "rule" || kept.kind === "at-rule") return { ...kept, nodes: kept.nodes.map((n2) => keepLocIn(n2, modules)) };
|
|
1587
|
+
return kept;
|
|
1588
|
+
}
|
|
1589
|
+
function printStyleWithMap(nodes, minify, sourceName, module, others) {
|
|
1590
|
+
const sources = [module];
|
|
1591
|
+
const index = /* @__PURE__ */ new Map([[sourceName, 0]]);
|
|
1592
|
+
const sourceOf = (name) => {
|
|
1593
|
+
if (index.has(name)) return index.get(name);
|
|
1594
|
+
const other = others?.get(name);
|
|
1595
|
+
if (!other) return void 0;
|
|
1596
|
+
index.set(name, sources.push(other) - 1);
|
|
1597
|
+
return index.get(name);
|
|
1598
|
+
};
|
|
1583
1599
|
const lines = [[]];
|
|
1584
1600
|
let css = "";
|
|
1585
1601
|
let column = 0;
|
|
@@ -1593,7 +1609,8 @@ function printStyleWithMap(nodes, minify, sourceName, module) {
|
|
|
1593
1609
|
}
|
|
1594
1610
|
};
|
|
1595
1611
|
const mark = (loc) => {
|
|
1596
|
-
|
|
1612
|
+
const at = loc ? sourceOf(loc.source) : void 0;
|
|
1613
|
+
if (loc && at !== void 0) lines[lines.length - 1].push([column, at, loc.line - 1, loc.column]);
|
|
1597
1614
|
};
|
|
1598
1615
|
const write = (node, depth) => {
|
|
1599
1616
|
const pad = minify ? "" : " ".repeat(depth);
|
|
@@ -1612,7 +1629,7 @@ function printStyleWithMap(nodes, minify, sourceName, module) {
|
|
|
1612
1629
|
}
|
|
1613
1630
|
};
|
|
1614
1631
|
for (const node of nodes) write(node, 0);
|
|
1615
|
-
return { css, map: { version: 3, sources:
|
|
1632
|
+
return { css, map: { version: 3, sources: sources.map((s) => s.id), sourcesContent: sources.map((s) => s.code), names: [], mappings: encode(lines) } };
|
|
1616
1633
|
}
|
|
1617
1634
|
function printStyle(nodes, minify = false) {
|
|
1618
1635
|
const out = [];
|