lapikit 0.0.0-insiders.da3209a → 0.0.0-insiders.de70c0c

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.
@@ -1,5 +1,4 @@
1
1
  import type { DevConfiguration } from '../../types/index.js';
2
2
  export declare function css(config: DevConfiguration): Promise<{
3
- themes: string;
4
- typography: string;
3
+ styles: string[];
5
4
  }>;
@@ -21,7 +21,6 @@ export async function css(config) {
21
21
  breakpoints: deepMerge(preset.breakpoints.thresholds, config?.breakpoints?.thresholds || {})
22
22
  });
23
23
  return {
24
- themes: themes,
25
- typography: typography
24
+ styles: [themes, typography]
26
25
  };
27
26
  }
@@ -0,0 +1 @@
1
+ export declare function getLapikitConfig(filePath: string): Promise<{}>;
@@ -0,0 +1,24 @@
1
+ import path from 'path';
2
+ import fs from 'fs';
3
+ import { terminal } from '../terminal.js';
4
+ const app = process.cwd();
5
+ export async function getLapikitConfig(filePath) {
6
+ const pathConfig = path.resolve(app, filePath);
7
+ if (!fs.existsSync(pathConfig))
8
+ process.exit(1);
9
+ const code = fs.readFileSync(pathConfig, 'utf-8');
10
+ const match = code.match(/createLapikit\s*\(\s*({[\s\S]*?})\s*\)/);
11
+ let options = {};
12
+ if (match && match[1]) {
13
+ try {
14
+ options = new Function('return ' + match[1])();
15
+ }
16
+ catch (e) {
17
+ terminal('error', `error parsing lapikit config: ${e}`);
18
+ }
19
+ }
20
+ else {
21
+ terminal('info', 'lapikit config has loaded successfully!');
22
+ }
23
+ return options;
24
+ }
@@ -7,4 +7,3 @@ export declare const parserCSSBreakpoints: (css: string) => {
7
7
  minmax: string;
8
8
  cleaned: string;
9
9
  };
10
- export declare const parserConfigLapikit: (app: string, filePath: string) => Promise<{}>;
@@ -1,6 +1,3 @@
1
- import path from 'path';
2
- import fs from 'fs';
3
- import { terminal } from '../terminal.js';
4
1
  export const parserValues = (value) => {
5
2
  if (typeof value === 'number')
6
3
  return `${value}px`;
@@ -71,23 +68,3 @@ export const parserCSSBreakpoints = (css) => {
71
68
  cleaned: cleaned.trim()
72
69
  };
73
70
  };
74
- export const parserConfigLapikit = async (app, filePath) => {
75
- const pathConfig = path.resolve(app, filePath);
76
- if (!fs.existsSync(pathConfig))
77
- process.exit(1);
78
- const code = fs.readFileSync(pathConfig, 'utf-8');
79
- const match = code.match(/createLapikit\s*\(\s*({[\s\S]*?})\s*\)/);
80
- let options = {};
81
- if (match && match[1]) {
82
- try {
83
- options = new Function('return ' + match[1])();
84
- }
85
- catch (e) {
86
- terminal('error', `Error parsing lapikit config: ${e}`);
87
- }
88
- }
89
- else {
90
- terminal('error', 'lapikit configuration not found please refer to the documentation https://lapikit.dev/docs/getting-started');
91
- }
92
- return options;
93
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lapikit",
3
- "version": "0.0.0-insiders.da3209a",
3
+ "version": "0.0.0-insiders.de70c0c",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -64,10 +64,7 @@
64
64
  "default": "./dist/actions/index.js"
65
65
  },
66
66
  "./css": "./dist/styles.css",
67
- "./styles": "./dist/labs.css",
68
- "./viteLab": {
69
- "default": "./dist/internal/plugins/vite.js"
70
- }
67
+ "./styles": "./dist/labs.css"
71
68
  },
72
69
  "peerDependencies": {
73
70
  "svelte": "^5.0.0"
@@ -1,8 +0,0 @@
1
- type Lapikit = {
2
- config?: string;
3
- };
4
- export declare function lapikitEvol({ config }?: Lapikit): Promise<{
5
- name: string;
6
- configResolved(): Promise<void>;
7
- }>;
8
- export {};
@@ -1,25 +0,0 @@
1
- import { fileURLToPath } from 'url';
2
- import { dirname } from 'path';
3
- import { terminal } from '../terminal.js';
4
- import { css } from '../../plugin/css.js';
5
- import { parserConfigLapikit } from '../helpers/parser.js';
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = dirname(__filename);
8
- import fsPromises from 'fs/promises';
9
- import path from 'path';
10
- const app = process.cwd();
11
- export async function lapikitEvol({ config } = {}) {
12
- return {
13
- name: 'lapikit/vite',
14
- async configResolved() {
15
- if (config) {
16
- const configuration = await parserConfigLapikit(app, config);
17
- // generate styles
18
- const styles = await css(configuration);
19
- fsPromises.writeFile(path.resolve(__dirname, '../labs.css'), styles?.themes);
20
- console.log('styles', styles);
21
- }
22
- terminal('info', 'lapikit is up!');
23
- }
24
- };
25
- }