@pikacss/integration 0.0.14 → 0.0.15
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 +11 -10
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +13 -12
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -118,7 +118,7 @@ function generateVueDeclaration(ctx) {
|
|
|
118
118
|
""
|
|
119
119
|
];
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
function generateOverloadContent(ctx) {
|
|
122
122
|
const paramsLines = [];
|
|
123
123
|
const fnsLines = [];
|
|
124
124
|
const usages = [...ctx.usages.values()].flat();
|
|
@@ -153,7 +153,7 @@ async function generateOverloadContent(ctx) {
|
|
|
153
153
|
...paramsLines
|
|
154
154
|
];
|
|
155
155
|
}
|
|
156
|
-
|
|
156
|
+
function generateTsCodegenContent(ctx) {
|
|
157
157
|
const lines = [
|
|
158
158
|
`// Auto-generated by ${ctx.currentPackageName}`,
|
|
159
159
|
`import type { CSSProperty, CSSSelectors, DefineAutocomplete, Properties, StyleDefinition, StyleItem } from '${ctx.currentPackageName}'`,
|
|
@@ -174,7 +174,7 @@ async function generateTsCodegenContent(ctx) {
|
|
|
174
174
|
lines.push(...generateStyleFn(ctx));
|
|
175
175
|
lines.push(...generateGlobalDeclaration(ctx));
|
|
176
176
|
lines.push(...generateVueDeclaration(ctx));
|
|
177
|
-
lines.push(...
|
|
177
|
+
lines.push(...generateOverloadContent(ctx));
|
|
178
178
|
return lines.join("\n");
|
|
179
179
|
}
|
|
180
180
|
|
|
@@ -346,7 +346,6 @@ async function createCtx(options) {
|
|
|
346
346
|
if (functionCalls.length === 0)
|
|
347
347
|
return;
|
|
348
348
|
const usages = [];
|
|
349
|
-
ctx.usages.set(id, usages);
|
|
350
349
|
const transformed = new MagicString__default(code);
|
|
351
350
|
for (const fnCall of functionCalls) {
|
|
352
351
|
const functionCallStr = fnCall.snippet;
|
|
@@ -358,7 +357,6 @@ async function createCtx(options) {
|
|
|
358
357
|
params: args
|
|
359
358
|
};
|
|
360
359
|
usages.push(usage);
|
|
361
|
-
ctx.hooks.tsCodegenUpdated.trigger();
|
|
362
360
|
let transformedContent;
|
|
363
361
|
if (ctx.fnUtils.isNormal(fnCall.fnName)) {
|
|
364
362
|
transformedContent = ctx.transformedFormat === "array" ? `[${names.map((n) => `'${n}'`).join(", ")}]` : ctx.transformedFormat === "string" ? `'${names.join(" ")}'` : names.join(" ");
|
|
@@ -373,6 +371,9 @@ async function createCtx(options) {
|
|
|
373
371
|
}
|
|
374
372
|
transformed.update(fnCall.start, fnCall.end + 1, transformedContent);
|
|
375
373
|
}
|
|
374
|
+
ctx.usages.set(id, usages);
|
|
375
|
+
ctx.hooks.styleUpdated.trigger();
|
|
376
|
+
ctx.hooks.tsCodegenUpdated.trigger();
|
|
376
377
|
return {
|
|
377
378
|
code: transformed.toString(),
|
|
378
379
|
map: transformed.generateMap({ hires: true })
|
|
@@ -382,7 +383,7 @@ async function createCtx(options) {
|
|
|
382
383
|
return void 0;
|
|
383
384
|
}
|
|
384
385
|
},
|
|
385
|
-
writeDevCssFile:
|
|
386
|
+
writeDevCssFile: () => {
|
|
386
387
|
if (ctx.isReady === false)
|
|
387
388
|
return;
|
|
388
389
|
const atomicStyleIds = [...new Set([...ctx.usages.values()].flatMap((i) => [...new Set(i.flatMap((i2) => i2.atomicStyleIds))]))];
|
|
@@ -391,13 +392,13 @@ async function createCtx(options) {
|
|
|
391
392
|
ctx.engine.renderPreflights(true),
|
|
392
393
|
ctx.engine.renderAtomicStyles(true, { atomicStyleIds })
|
|
393
394
|
].join("\n").trim();
|
|
394
|
-
|
|
395
|
+
node_fs.writeFileSync(ctx.devCssFilepath, css);
|
|
395
396
|
},
|
|
396
|
-
writeTsCodegenFile:
|
|
397
|
+
writeTsCodegenFile: () => {
|
|
397
398
|
if (ctx.isReady === false || ctx.tsCodegenFilepath == null)
|
|
398
399
|
return;
|
|
399
|
-
const content =
|
|
400
|
-
|
|
400
|
+
const content = generateTsCodegenContent(ctx);
|
|
401
|
+
node_fs.writeFileSync(ctx.tsCodegenFilepath, content);
|
|
401
402
|
}
|
|
402
403
|
};
|
|
403
404
|
await ctx.init();
|
package/dist/index.d.cts
CHANGED
|
@@ -56,8 +56,8 @@ interface IntegrationContext {
|
|
|
56
56
|
code: string;
|
|
57
57
|
map: SourceMap;
|
|
58
58
|
} | Nullish>;
|
|
59
|
-
writeDevCssFile: () =>
|
|
60
|
-
writeTsCodegenFile: () =>
|
|
59
|
+
writeDevCssFile: () => void;
|
|
60
|
+
writeTsCodegenFile: () => void;
|
|
61
61
|
}
|
|
62
62
|
interface IntegrationContextOptions {
|
|
63
63
|
cwd: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -56,8 +56,8 @@ interface IntegrationContext {
|
|
|
56
56
|
code: string;
|
|
57
57
|
map: SourceMap;
|
|
58
58
|
} | Nullish>;
|
|
59
|
-
writeDevCssFile: () =>
|
|
60
|
-
writeTsCodegenFile: () =>
|
|
59
|
+
writeDevCssFile: () => void;
|
|
60
|
+
writeTsCodegenFile: () => void;
|
|
61
61
|
}
|
|
62
62
|
interface IntegrationContextOptions {
|
|
63
63
|
cwd: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -56,8 +56,8 @@ interface IntegrationContext {
|
|
|
56
56
|
code: string;
|
|
57
57
|
map: SourceMap;
|
|
58
58
|
} | Nullish>;
|
|
59
|
-
writeDevCssFile: () =>
|
|
60
|
-
writeTsCodegenFile: () =>
|
|
59
|
+
writeDevCssFile: () => void;
|
|
60
|
+
writeTsCodegenFile: () => void;
|
|
61
61
|
}
|
|
62
62
|
interface IntegrationContextOptions {
|
|
63
63
|
cwd: string;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { statSync } from 'node:fs';
|
|
2
|
-
import {
|
|
1
|
+
import { writeFileSync, statSync } from 'node:fs';
|
|
2
|
+
import { mkdir, stat, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { setWarnFn, warn, createEngine } from '@pikacss/core';
|
|
4
4
|
export * from '@pikacss/core';
|
|
5
5
|
import { createJiti } from 'jiti';
|
|
@@ -112,7 +112,7 @@ function generateVueDeclaration(ctx) {
|
|
|
112
112
|
""
|
|
113
113
|
];
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
function generateOverloadContent(ctx) {
|
|
116
116
|
const paramsLines = [];
|
|
117
117
|
const fnsLines = [];
|
|
118
118
|
const usages = [...ctx.usages.values()].flat();
|
|
@@ -147,7 +147,7 @@ async function generateOverloadContent(ctx) {
|
|
|
147
147
|
...paramsLines
|
|
148
148
|
];
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
function generateTsCodegenContent(ctx) {
|
|
151
151
|
const lines = [
|
|
152
152
|
`// Auto-generated by ${ctx.currentPackageName}`,
|
|
153
153
|
`import type { CSSProperty, CSSSelectors, DefineAutocomplete, Properties, StyleDefinition, StyleItem } from '${ctx.currentPackageName}'`,
|
|
@@ -168,7 +168,7 @@ async function generateTsCodegenContent(ctx) {
|
|
|
168
168
|
lines.push(...generateStyleFn(ctx));
|
|
169
169
|
lines.push(...generateGlobalDeclaration(ctx));
|
|
170
170
|
lines.push(...generateVueDeclaration(ctx));
|
|
171
|
-
lines.push(...
|
|
171
|
+
lines.push(...generateOverloadContent(ctx));
|
|
172
172
|
return lines.join("\n");
|
|
173
173
|
}
|
|
174
174
|
|
|
@@ -340,7 +340,6 @@ async function createCtx(options) {
|
|
|
340
340
|
if (functionCalls.length === 0)
|
|
341
341
|
return;
|
|
342
342
|
const usages = [];
|
|
343
|
-
ctx.usages.set(id, usages);
|
|
344
343
|
const transformed = new MagicString(code);
|
|
345
344
|
for (const fnCall of functionCalls) {
|
|
346
345
|
const functionCallStr = fnCall.snippet;
|
|
@@ -352,7 +351,6 @@ async function createCtx(options) {
|
|
|
352
351
|
params: args
|
|
353
352
|
};
|
|
354
353
|
usages.push(usage);
|
|
355
|
-
ctx.hooks.tsCodegenUpdated.trigger();
|
|
356
354
|
let transformedContent;
|
|
357
355
|
if (ctx.fnUtils.isNormal(fnCall.fnName)) {
|
|
358
356
|
transformedContent = ctx.transformedFormat === "array" ? `[${names.map((n) => `'${n}'`).join(", ")}]` : ctx.transformedFormat === "string" ? `'${names.join(" ")}'` : names.join(" ");
|
|
@@ -367,6 +365,9 @@ async function createCtx(options) {
|
|
|
367
365
|
}
|
|
368
366
|
transformed.update(fnCall.start, fnCall.end + 1, transformedContent);
|
|
369
367
|
}
|
|
368
|
+
ctx.usages.set(id, usages);
|
|
369
|
+
ctx.hooks.styleUpdated.trigger();
|
|
370
|
+
ctx.hooks.tsCodegenUpdated.trigger();
|
|
370
371
|
return {
|
|
371
372
|
code: transformed.toString(),
|
|
372
373
|
map: transformed.generateMap({ hires: true })
|
|
@@ -376,7 +377,7 @@ async function createCtx(options) {
|
|
|
376
377
|
return void 0;
|
|
377
378
|
}
|
|
378
379
|
},
|
|
379
|
-
writeDevCssFile:
|
|
380
|
+
writeDevCssFile: () => {
|
|
380
381
|
if (ctx.isReady === false)
|
|
381
382
|
return;
|
|
382
383
|
const atomicStyleIds = [...new Set([...ctx.usages.values()].flatMap((i) => [...new Set(i.flatMap((i2) => i2.atomicStyleIds))]))];
|
|
@@ -385,13 +386,13 @@ async function createCtx(options) {
|
|
|
385
386
|
ctx.engine.renderPreflights(true),
|
|
386
387
|
ctx.engine.renderAtomicStyles(true, { atomicStyleIds })
|
|
387
388
|
].join("\n").trim();
|
|
388
|
-
|
|
389
|
+
writeFileSync(ctx.devCssFilepath, css);
|
|
389
390
|
},
|
|
390
|
-
writeTsCodegenFile:
|
|
391
|
+
writeTsCodegenFile: () => {
|
|
391
392
|
if (ctx.isReady === false || ctx.tsCodegenFilepath == null)
|
|
392
393
|
return;
|
|
393
|
-
const content =
|
|
394
|
-
|
|
394
|
+
const content = generateTsCodegenContent(ctx);
|
|
395
|
+
writeFileSync(ctx.tsCodegenFilepath, content);
|
|
395
396
|
}
|
|
396
397
|
};
|
|
397
398
|
await ctx.init();
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.0.
|
|
7
|
+
"version": "0.0.15",
|
|
8
8
|
"author": "DevilTea <ch19980814@gmail.com>",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"magic-string": "^0.30.12",
|
|
41
41
|
"micromatch": "^4.0.8",
|
|
42
42
|
"pathe": "^2.0.3",
|
|
43
|
-
"@pikacss/core": "0.0.
|
|
43
|
+
"@pikacss/core": "0.0.15"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/micromatch": "^4.0.9"
|