@pikacss/integration 0.0.16 → 0.0.18

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
@@ -4,6 +4,7 @@ const node_fs = require('node:fs');
4
4
  const promises = require('node:fs/promises');
5
5
  const core = require('@pikacss/core');
6
6
  const jiti = require('jiti');
7
+ const klona = require('klona');
7
8
  const localPkg = require('local-pkg');
8
9
  const MagicString = require('magic-string');
9
10
  const micromatch = require('micromatch');
@@ -269,10 +270,10 @@ async function createCtx(options) {
269
270
  },
270
271
  loadConfig: async () => {
271
272
  if (inlineConfig != null)
272
- return { config: inlineConfig, file: null };
273
+ return { config: klona.klona(inlineConfig), file: null };
273
274
  let resolvedConfigPath = configSources.find((path) => {
274
- const stat2 = node_fs.statSync(path, { throwIfNoEntry: false });
275
- return stat2 != null && stat2.isFile();
275
+ const stat = node_fs.statSync(path, { throwIfNoEntry: false });
276
+ return stat != null && stat.isFile();
276
277
  });
277
278
  if (resolvedConfigPath == null) {
278
279
  if (autoCreateConfig === false)
@@ -295,7 +296,7 @@ async function createCtx(options) {
295
296
  moduleCache: false
296
297
  });
297
298
  const config = await jiti$1.import(resolvedConfigPath, { default: true });
298
- return { config, file: resolvedConfigPath };
299
+ return { config: klona.klona(config), file: resolvedConfigPath };
299
300
  },
300
301
  init: perfectDebounce.debounce(async () => {
301
302
  ctx.isReady = false;
@@ -322,17 +323,12 @@ async function createCtx(options) {
322
323
  }
323
324
  await promises.mkdir(pathe.dirname(devCssFilepath), { recursive: true }).catch(() => {
324
325
  });
325
- const isDevCssFileExists = await promises.stat(devCssFilepath).then((stat2) => stat2.isFile()).catch(() => false);
326
- if (isDevCssFileExists === false)
327
- await promises.writeFile(devCssFilepath, "");
326
+ await promises.writeFile(devCssFilepath, "");
328
327
  if (tsCodegenFilepath != null) {
329
328
  await promises.mkdir(pathe.dirname(tsCodegenFilepath), { recursive: true }).catch(() => {
330
329
  });
331
- const isGenTsFileExists = await promises.stat(tsCodegenFilepath).then((stat2) => stat2.isFile()).catch(() => false);
332
- if (isGenTsFileExists === false) {
333
- const content = generateTsCodegenContent(ctx);
334
- await promises.writeFile(tsCodegenFilepath, content);
335
- }
330
+ const content = generateTsCodegenContent(ctx);
331
+ await promises.writeFile(tsCodegenFilepath, content);
336
332
  }
337
333
  ctx.isReady = true;
338
334
  }, 300),
package/dist/index.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  import { statSync } from 'node:fs';
2
- import { writeFile, mkdir, stat } from 'node:fs/promises';
2
+ import { writeFile, mkdir } from 'node:fs/promises';
3
3
  import { setWarnFn, warn, defineEnginePlugin, createEngine } from '@pikacss/core';
4
4
  export * from '@pikacss/core';
5
5
  import { createJiti } from 'jiti';
6
+ import { klona } from 'klona';
6
7
  import { isPackageExists } from 'local-pkg';
7
8
  import MagicString from 'magic-string';
8
9
  import micromatch from 'micromatch';
@@ -263,10 +264,10 @@ async function createCtx(options) {
263
264
  },
264
265
  loadConfig: async () => {
265
266
  if (inlineConfig != null)
266
- return { config: inlineConfig, file: null };
267
+ return { config: klona(inlineConfig), file: null };
267
268
  let resolvedConfigPath = configSources.find((path) => {
268
- const stat2 = statSync(path, { throwIfNoEntry: false });
269
- return stat2 != null && stat2.isFile();
269
+ const stat = statSync(path, { throwIfNoEntry: false });
270
+ return stat != null && stat.isFile();
270
271
  });
271
272
  if (resolvedConfigPath == null) {
272
273
  if (autoCreateConfig === false)
@@ -289,7 +290,7 @@ async function createCtx(options) {
289
290
  moduleCache: false
290
291
  });
291
292
  const config = await jiti.import(resolvedConfigPath, { default: true });
292
- return { config, file: resolvedConfigPath };
293
+ return { config: klona(config), file: resolvedConfigPath };
293
294
  },
294
295
  init: debounce(async () => {
295
296
  ctx.isReady = false;
@@ -316,17 +317,12 @@ async function createCtx(options) {
316
317
  }
317
318
  await mkdir(dirname(devCssFilepath), { recursive: true }).catch(() => {
318
319
  });
319
- const isDevCssFileExists = await stat(devCssFilepath).then((stat2) => stat2.isFile()).catch(() => false);
320
- if (isDevCssFileExists === false)
321
- await writeFile(devCssFilepath, "");
320
+ await writeFile(devCssFilepath, "");
322
321
  if (tsCodegenFilepath != null) {
323
322
  await mkdir(dirname(tsCodegenFilepath), { recursive: true }).catch(() => {
324
323
  });
325
- const isGenTsFileExists = await stat(tsCodegenFilepath).then((stat2) => stat2.isFile()).catch(() => false);
326
- if (isGenTsFileExists === false) {
327
- const content = generateTsCodegenContent(ctx);
328
- await writeFile(tsCodegenFilepath, content);
329
- }
324
+ const content = generateTsCodegenContent(ctx);
325
+ await writeFile(tsCodegenFilepath, content);
330
326
  }
331
327
  ctx.isReady = true;
332
328
  }, 300),
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.0.16",
7
+ "version": "0.0.18",
8
8
  "author": "DevilTea <ch19980814@gmail.com>",
9
9
  "license": "MIT",
10
10
  "repository": {
@@ -36,12 +36,13 @@
36
36
  "dependencies": {
37
37
  "fast-glob": "^3.3.2",
38
38
  "jiti": "^2.4.0",
39
+ "klona": "^2.0.6",
39
40
  "local-pkg": "^1.1.1",
40
41
  "magic-string": "^0.30.12",
41
42
  "micromatch": "^4.0.8",
42
43
  "pathe": "^2.0.3",
43
44
  "perfect-debounce": "^1.0.0",
44
- "@pikacss/core": "0.0.16"
45
+ "@pikacss/core": "0.0.18"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@types/micromatch": "^4.0.9"