@leexi/shared 0.2.0 → 0.3.0

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,43 +0,0 @@
1
- import tailwind from 'eslint-plugin-tailwindcss';
2
- import vue from 'eslint-plugin-vue';
3
- import base from './base.js';
4
- export default [
5
- ...base,
6
- ...tailwind.configs['flat/recommended'],
7
- ...vue.configs['flat/recommended'],
8
- {
9
- files: ['**/*.vue'],
10
- rules: {
11
- '@stylistic/js/indent': 'off',
12
- '@stylistic/js/object-curly-spacing': 'off',
13
- 'tailwindcss/no-custom-classname': 'error',
14
- 'vue/attributes-order': ['error', {
15
- alphabetical: true,
16
- }],
17
- 'vue/component-name-in-template-casing': ['error', 'PascalCase', {
18
- registeredComponentsOnly: false,
19
- }],
20
- 'vue/first-attribute-linebreak': ['error', {
21
- singleline: 'beside',
22
- }],
23
- 'vue/multi-word-component-names': 'off',
24
- 'vue/no-bare-strings-in-template': ['error', {
25
- allowlist: ['Leexi'],
26
- }],
27
- 'vue/object-curly-spacing': ['error', 'always'],
28
- 'vue/prefer-template': 'error',
29
- 'vue/script-indent': ['error', 2, {
30
- baseIndent: 1,
31
- switchCase: 1,
32
- }],
33
- 'vue/template-curly-spacing': ['error', 'never'],
34
- },
35
- },
36
- {
37
- ignores: [
38
- '.nuxt/',
39
- '.output/',
40
- 'dist/',
41
- ],
42
- },
43
- ];
package/dist/module.d.ts DELETED
@@ -1,8 +0,0 @@
1
- declare const _default: import("@nuxt/schema").NuxtModule<{
2
- composables: boolean;
3
- utils: boolean;
4
- }, {
5
- composables: boolean;
6
- utils: boolean;
7
- }, false>;
8
- export default _default;
package/dist/module.js DELETED
@@ -1,36 +0,0 @@
1
- import { readdirSync, statSync } from 'fs';
2
- import { addImports, createResolver, defineNuxtModule } from '@nuxt/kit';
3
- export default defineNuxtModule({
4
- defaults: {
5
- composables: true,
6
- utils: true,
7
- },
8
- meta: {
9
- configKey: 'leexi',
10
- name: '@leexi/shared',
11
- },
12
- setup: options => {
13
- const resolver = createResolver(import.meta.url);
14
- const addImportsDir = (dir) => {
15
- const files = readdirSync(dir);
16
- files.forEach(file => {
17
- if (/index/.test(file) || /\.d\.ts/.test(file)) {
18
- return;
19
- }
20
- const path = resolver.resolve(`${dir}/${file}`);
21
- const stat = statSync(path);
22
- if (stat.isDirectory()) {
23
- return addImportsDir(path);
24
- }
25
- const [name] = file.split('.');
26
- addImports({ as: name, from: path, name });
27
- });
28
- };
29
- if (options.composables) {
30
- addImportsDir(resolver.resolve('./composables'));
31
- }
32
- if (options.utils) {
33
- addImportsDir(resolver.resolve('./utils'));
34
- }
35
- },
36
- });
@@ -1 +0,0 @@
1
- export * from './objects/index.js';
@@ -1 +0,0 @@
1
- export * from './objects/index.js';
@@ -1,12 +0,0 @@
1
- /**
2
- * Deeply duplicates an object.
3
- *
4
- * @param object - an object
5
- * @returns a duplicate of the same object
6
- *
7
- * @example
8
- * const object = [{ foo: 'bar' }]
9
- * const dup = deepDup(object) // => `[{ foo: 'bar' }]`
10
- * object === dup // => `false`
11
- */
12
- export declare const deepDup: <T extends object>(object: T) => T;
@@ -1,28 +0,0 @@
1
- /**
2
- * Deeply duplicates an object.
3
- *
4
- * @param object - an object
5
- * @returns a duplicate of the same object
6
- *
7
- * @example
8
- * const object = [{ foo: 'bar' }]
9
- * const dup = deepDup(object) // => `[{ foo: 'bar' }]`
10
- * object === dup // => `false`
11
- */
12
- export const deepDup = (object) => {
13
- if (!object || typeof object !== 'object') {
14
- return object;
15
- }
16
- const duplicate = (value) => value && typeof value === 'object' ? deepDup(value) : value;
17
- if (Array.isArray(object)) {
18
- return object.map(duplicate);
19
- }
20
- if (object instanceof Set) {
21
- return new Set([...object].map(duplicate));
22
- }
23
- if (Object.getPrototypeOf(object) === Object.prototype) {
24
- const dup = Object.entries(object).map(([key, value]) => [key, duplicate(value)]);
25
- return Object.fromEntries(dup);
26
- }
27
- return object;
28
- };
@@ -1,2 +0,0 @@
1
- export { deepDup } from './deepDup.js';
2
- export { isSame } from './isSame.js';
@@ -1,2 +0,0 @@
1
- export { deepDup } from './deepDup.js';
2
- export { isSame } from './isSame.js';
@@ -1,12 +0,0 @@
1
- /**
2
- * Compares whether two objects are identical.
3
- *
4
- * @param a - an object
5
- * @param b - another object
6
- * @returns whether these objects are identical
7
- *
8
- * @example
9
- * isSame([{ foo: 'bar' }], [{ foo: 'bar' }]) // => `true`
10
- * isSame([{ foo: 'bar' }], [{ bar: 'foo' }]) // => `false`
11
- */
12
- export declare const isSame: (a: object, b: object) => boolean;
@@ -1,12 +0,0 @@
1
- /**
2
- * Compares whether two objects are identical.
3
- *
4
- * @param a - an object
5
- * @param b - another object
6
- * @returns whether these objects are identical
7
- *
8
- * @example
9
- * isSame([{ foo: 'bar' }], [{ foo: 'bar' }]) // => `true`
10
- * isSame([{ foo: 'bar' }], [{ bar: 'foo' }]) // => `false`
11
- */
12
- export const isSame = (a, b) => JSON.stringify(a) === JSON.stringify(b);