@pikacss/integration 0.0.23 → 0.0.25

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
@@ -120,7 +120,7 @@ function generateVueDeclaration(ctx) {
120
120
  ""
121
121
  ];
122
122
  }
123
- function generateOverloadContent(ctx) {
123
+ async function generateOverloadContent(ctx) {
124
124
  const paramsLines = [];
125
125
  const fnsLines = [];
126
126
  const usages = [...ctx.usages.values()].flat();
@@ -133,7 +133,7 @@ function generateOverloadContent(ctx) {
133
133
  " * ### PikaCSS Preview",
134
134
  " * ```css",
135
135
  // CSS Lines
136
- ...ctx.engine.renderAtomicStyles(true, { atomicStyleIds: usage.atomicStyleIds, isPreview: true }).trim().split("\n").map((line) => ` * \u200E${line.replace(/^(\s*)/, "$1\u200E")}`),
136
+ ...(await ctx.engine.renderAtomicStyles(true, { atomicStyleIds: usage.atomicStyleIds, isPreview: true })).trim().split("\n").map((line) => ` * \u200E${line.replace(/^(\s*)/, "$1\u200E")}`),
137
137
  " * ```",
138
138
  " */",
139
139
  ` fn(...params: [${usage.params.map((_, index) => `p${index}: P${i}_${index}`).join(", ")}]): ReturnType<StyleFn>`
@@ -155,7 +155,7 @@ function generateOverloadContent(ctx) {
155
155
  ...paramsLines
156
156
  ];
157
157
  }
158
- function generateTsCodegenContent(ctx) {
158
+ async function generateTsCodegenContent(ctx) {
159
159
  const lines = [
160
160
  `// Auto-generated by ${ctx.currentPackageName}`,
161
161
  `import type { CSSProperty, CSSSelectors, DefineAutocomplete, Properties, StyleDefinition, StyleItem } from '${ctx.currentPackageName}'`,
@@ -176,7 +176,7 @@ function generateTsCodegenContent(ctx) {
176
176
  lines.push(...generateStyleFn(ctx));
177
177
  lines.push(...generateGlobalDeclaration(ctx));
178
178
  lines.push(...generateVueDeclaration(ctx));
179
- lines.push(...generateOverloadContent(ctx));
179
+ lines.push(...await generateOverloadContent(ctx));
180
180
  return lines.join("\n");
181
181
  }
182
182
 
@@ -283,8 +283,8 @@ async function createCtx(options) {
283
283
  });
284
284
  const relativeTsCodegenFilepath = tsCodegenFilepath == null ? null : `./${pathe.relative(pathe.dirname(resolvedConfigPath), tsCodegenFilepath)}`;
285
285
  await promises.writeFile(resolvedConfigPath, [
286
- ...relativeTsCodegenFilepath == null ? [] : [`/// <reference path="${relativeTsCodegenFilepath}" />`],
287
286
  `import { defineEngineConfig } from '${currentPackageName}'`,
287
+ ...relativeTsCodegenFilepath == null ? [] : [`import '${relativeTsCodegenFilepath}'`],
288
288
  "",
289
289
  "export default defineEngineConfig({",
290
290
  " // Add your PikaCSS engine config here",
@@ -327,7 +327,7 @@ async function createCtx(options) {
327
327
  if (tsCodegenFilepath != null) {
328
328
  await promises.mkdir(pathe.dirname(tsCodegenFilepath), { recursive: true }).catch(() => {
329
329
  });
330
- const content = generateTsCodegenContent(ctx);
330
+ const content = await generateTsCodegenContent(ctx);
331
331
  await promises.writeFile(tsCodegenFilepath, content);
332
332
  }
333
333
  ctx.isReady = true;
@@ -383,31 +383,31 @@ async function createCtx(options) {
383
383
  return void 0;
384
384
  }
385
385
  },
386
- getCssContent: (isDev) => {
386
+ getCssContent: async (isDev) => {
387
387
  if (ctx.isReady === false)
388
388
  return null;
389
389
  const atomicStyleIds = [...new Set([...ctx.usages.values()].flatMap((i) => [...new Set(i.flatMap((i2) => i2.atomicStyleIds))]))];
390
390
  const css = [
391
391
  `/* Auto-generated by ${ctx.currentPackageName} */`,
392
- ctx.engine.renderPreflights(isDev),
393
- ctx.engine.renderAtomicStyles(isDev, { atomicStyleIds })
392
+ await ctx.engine.renderPreflights(isDev),
393
+ await ctx.engine.renderAtomicStyles(isDev, { atomicStyleIds })
394
394
  ].join("\n").trim();
395
395
  return css;
396
396
  },
397
- getTsCodegenContent: () => {
397
+ getTsCodegenContent: async () => {
398
398
  if (ctx.isReady === false || ctx.tsCodegenFilepath == null)
399
399
  return null;
400
- const content = generateTsCodegenContent(ctx);
400
+ const content = await generateTsCodegenContent(ctx);
401
401
  return content;
402
402
  },
403
403
  writeDevCssFile: perfectDebounce.debounce(async () => {
404
- const content = ctx.getCssContent(true);
404
+ const content = await ctx.getCssContent(true);
405
405
  if (content == null)
406
406
  return;
407
407
  await promises.writeFile(ctx.devCssFilepath, content);
408
408
  }, 300),
409
409
  writeTsCodegenFile: perfectDebounce.debounce(async () => {
410
- const content = ctx.getTsCodegenContent();
410
+ const content = await ctx.getTsCodegenContent();
411
411
  if (ctx.tsCodegenFilepath == null || content == null)
412
412
  return;
413
413
  await promises.writeFile(ctx.tsCodegenFilepath, content);
package/dist/index.d.cts CHANGED
@@ -56,8 +56,8 @@ interface IntegrationContext {
56
56
  code: string;
57
57
  map: SourceMap;
58
58
  } | Nullish>;
59
- getCssContent: (isDev: boolean) => string | Nullish;
60
- getTsCodegenContent: () => string | Nullish;
59
+ getCssContent: (isDev: boolean) => Promise<string | Nullish>;
60
+ getTsCodegenContent: () => Promise<string | Nullish>;
61
61
  writeDevCssFile: () => Promise<void>;
62
62
  writeTsCodegenFile: () => Promise<void>;
63
63
  }
package/dist/index.d.mts CHANGED
@@ -56,8 +56,8 @@ interface IntegrationContext {
56
56
  code: string;
57
57
  map: SourceMap;
58
58
  } | Nullish>;
59
- getCssContent: (isDev: boolean) => string | Nullish;
60
- getTsCodegenContent: () => string | Nullish;
59
+ getCssContent: (isDev: boolean) => Promise<string | Nullish>;
60
+ getTsCodegenContent: () => Promise<string | Nullish>;
61
61
  writeDevCssFile: () => Promise<void>;
62
62
  writeTsCodegenFile: () => Promise<void>;
63
63
  }
package/dist/index.d.ts CHANGED
@@ -56,8 +56,8 @@ interface IntegrationContext {
56
56
  code: string;
57
57
  map: SourceMap;
58
58
  } | Nullish>;
59
- getCssContent: (isDev: boolean) => string | Nullish;
60
- getTsCodegenContent: () => string | Nullish;
59
+ getCssContent: (isDev: boolean) => Promise<string | Nullish>;
60
+ getTsCodegenContent: () => Promise<string | Nullish>;
61
61
  writeDevCssFile: () => Promise<void>;
62
62
  writeTsCodegenFile: () => Promise<void>;
63
63
  }
package/dist/index.mjs CHANGED
@@ -114,7 +114,7 @@ function generateVueDeclaration(ctx) {
114
114
  ""
115
115
  ];
116
116
  }
117
- function generateOverloadContent(ctx) {
117
+ async function generateOverloadContent(ctx) {
118
118
  const paramsLines = [];
119
119
  const fnsLines = [];
120
120
  const usages = [...ctx.usages.values()].flat();
@@ -127,7 +127,7 @@ function generateOverloadContent(ctx) {
127
127
  " * ### PikaCSS Preview",
128
128
  " * ```css",
129
129
  // CSS Lines
130
- ...ctx.engine.renderAtomicStyles(true, { atomicStyleIds: usage.atomicStyleIds, isPreview: true }).trim().split("\n").map((line) => ` * \u200E${line.replace(/^(\s*)/, "$1\u200E")}`),
130
+ ...(await ctx.engine.renderAtomicStyles(true, { atomicStyleIds: usage.atomicStyleIds, isPreview: true })).trim().split("\n").map((line) => ` * \u200E${line.replace(/^(\s*)/, "$1\u200E")}`),
131
131
  " * ```",
132
132
  " */",
133
133
  ` fn(...params: [${usage.params.map((_, index) => `p${index}: P${i}_${index}`).join(", ")}]): ReturnType<StyleFn>`
@@ -149,7 +149,7 @@ function generateOverloadContent(ctx) {
149
149
  ...paramsLines
150
150
  ];
151
151
  }
152
- function generateTsCodegenContent(ctx) {
152
+ async function generateTsCodegenContent(ctx) {
153
153
  const lines = [
154
154
  `// Auto-generated by ${ctx.currentPackageName}`,
155
155
  `import type { CSSProperty, CSSSelectors, DefineAutocomplete, Properties, StyleDefinition, StyleItem } from '${ctx.currentPackageName}'`,
@@ -170,7 +170,7 @@ function generateTsCodegenContent(ctx) {
170
170
  lines.push(...generateStyleFn(ctx));
171
171
  lines.push(...generateGlobalDeclaration(ctx));
172
172
  lines.push(...generateVueDeclaration(ctx));
173
- lines.push(...generateOverloadContent(ctx));
173
+ lines.push(...await generateOverloadContent(ctx));
174
174
  return lines.join("\n");
175
175
  }
176
176
 
@@ -277,8 +277,8 @@ async function createCtx(options) {
277
277
  });
278
278
  const relativeTsCodegenFilepath = tsCodegenFilepath == null ? null : `./${relative(dirname(resolvedConfigPath), tsCodegenFilepath)}`;
279
279
  await writeFile(resolvedConfigPath, [
280
- ...relativeTsCodegenFilepath == null ? [] : [`/// <reference path="${relativeTsCodegenFilepath}" />`],
281
280
  `import { defineEngineConfig } from '${currentPackageName}'`,
281
+ ...relativeTsCodegenFilepath == null ? [] : [`import '${relativeTsCodegenFilepath}'`],
282
282
  "",
283
283
  "export default defineEngineConfig({",
284
284
  " // Add your PikaCSS engine config here",
@@ -321,7 +321,7 @@ async function createCtx(options) {
321
321
  if (tsCodegenFilepath != null) {
322
322
  await mkdir(dirname(tsCodegenFilepath), { recursive: true }).catch(() => {
323
323
  });
324
- const content = generateTsCodegenContent(ctx);
324
+ const content = await generateTsCodegenContent(ctx);
325
325
  await writeFile(tsCodegenFilepath, content);
326
326
  }
327
327
  ctx.isReady = true;
@@ -377,31 +377,31 @@ async function createCtx(options) {
377
377
  return void 0;
378
378
  }
379
379
  },
380
- getCssContent: (isDev) => {
380
+ getCssContent: async (isDev) => {
381
381
  if (ctx.isReady === false)
382
382
  return null;
383
383
  const atomicStyleIds = [...new Set([...ctx.usages.values()].flatMap((i) => [...new Set(i.flatMap((i2) => i2.atomicStyleIds))]))];
384
384
  const css = [
385
385
  `/* Auto-generated by ${ctx.currentPackageName} */`,
386
- ctx.engine.renderPreflights(isDev),
387
- ctx.engine.renderAtomicStyles(isDev, { atomicStyleIds })
386
+ await ctx.engine.renderPreflights(isDev),
387
+ await ctx.engine.renderAtomicStyles(isDev, { atomicStyleIds })
388
388
  ].join("\n").trim();
389
389
  return css;
390
390
  },
391
- getTsCodegenContent: () => {
391
+ getTsCodegenContent: async () => {
392
392
  if (ctx.isReady === false || ctx.tsCodegenFilepath == null)
393
393
  return null;
394
- const content = generateTsCodegenContent(ctx);
394
+ const content = await generateTsCodegenContent(ctx);
395
395
  return content;
396
396
  },
397
397
  writeDevCssFile: debounce(async () => {
398
- const content = ctx.getCssContent(true);
398
+ const content = await ctx.getCssContent(true);
399
399
  if (content == null)
400
400
  return;
401
401
  await writeFile(ctx.devCssFilepath, content);
402
402
  }, 300),
403
403
  writeTsCodegenFile: debounce(async () => {
404
- const content = ctx.getTsCodegenContent();
404
+ const content = await ctx.getTsCodegenContent();
405
405
  if (ctx.tsCodegenFilepath == null || content == null)
406
406
  return;
407
407
  await writeFile(ctx.tsCodegenFilepath, content);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.0.23",
7
+ "version": "0.0.25",
8
8
  "author": "DevilTea <ch19980814@gmail.com>",
9
9
  "license": "MIT",
10
10
  "repository": {
@@ -42,7 +42,7 @@
42
42
  "micromatch": "^4.0.8",
43
43
  "pathe": "^2.0.3",
44
44
  "perfect-debounce": "^1.0.0",
45
- "@pikacss/core": "0.0.23"
45
+ "@pikacss/core": "0.0.25"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/micromatch": "^4.0.9"