@simple-photo-gallery/common 1.0.1 → 1.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simple-photo-gallery/common",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Shared utilities and types for Simple Photo Gallery",
5
5
  "license": "MIT",
6
6
  "author": "Vladimir Haltakov, Tomasz Rusin",
@@ -9,6 +9,18 @@
9
9
  "url": "https://github.com/SimplePhotoGallery/core"
10
10
  },
11
11
  "type": "module",
12
+ "main": "./dist/gallery.js",
13
+ "types": "./dist/gallery.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/gallery.d.ts",
17
+ "import": "./dist/gallery.js",
18
+ "require": "./dist/gallery.cjs"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
12
24
  "scripts": {
13
25
  "build": "yarn clean && tsup",
14
26
  "clean": "rm -rf dist",
package/.prettierignore DELETED
@@ -1,5 +0,0 @@
1
- **/dist/*
2
- **/node_modules/*
3
- **/coverage/*
4
- **/temp/*
5
- **/dist/*
package/.prettierrc.mjs DELETED
@@ -1,18 +0,0 @@
1
- /**
2
- * @see https://prettier.io/docs/configuration
3
- * @type {import("prettier").Config}
4
- */
5
- const config = {
6
- semi: true,
7
- printWidth: 125,
8
- tabWidth: 2,
9
- useTabs: false,
10
- singleQuote: true,
11
- endOfLine: 'lf',
12
- bracketSpacing: true,
13
- trailingComma: 'all',
14
- quoteProps: 'as-needed',
15
- bracketSameLine: true,
16
- };
17
-
18
- export default config;
package/eslint.config.mjs DELETED
@@ -1,113 +0,0 @@
1
- import eslint from '@eslint/js';
2
- import eslintConfigPrettier from 'eslint-config-prettier';
3
- import importPlugin from 'eslint-plugin-import';
4
- import eslintPluginUnicorn from 'eslint-plugin-unicorn';
5
- import globals from 'globals';
6
- import path from 'node:path';
7
- import tseslint from 'typescript-eslint';
8
-
9
- const tseslintConfig = tseslint.config(eslint.configs.recommended, tseslint.configs.recommended);
10
-
11
- const eslintConfig = [
12
- {
13
- ignores: [
14
- 'node_modules',
15
- '.github',
16
- 'tsconfig.tsbuildinfo',
17
- '**/dist/*',
18
- 'tsconfig.json',
19
- 'eslint.config.mjs',
20
- 'jest.config.cjs',
21
- '.prettierrc.mjs',
22
- ],
23
- },
24
- ...tseslintConfig,
25
- eslintConfigPrettier,
26
- eslintPluginUnicorn.configs.recommended,
27
- importPlugin.flatConfigs.recommended,
28
- importPlugin.flatConfigs.typescript,
29
- {
30
- files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
31
- languageOptions: {
32
- ecmaVersion: 2020,
33
- parserOptions: {
34
- tsconfigRootDir: import.meta.dirname,
35
- project: './tsconfig.json',
36
- },
37
- globals: {
38
- ...globals.jest,
39
- ...globals.browser,
40
- AddEventListenerOptions: 'readonly',
41
- EventListener: 'readonly',
42
- },
43
- },
44
- settings: {
45
- 'import/resolver': {
46
- node: {
47
- paths: ['src'],
48
- extensions: ['.js', '.jsx', '.ts', '.d.ts', '.tsx'],
49
- },
50
- typescript: {
51
- project: './tsconfig.json',
52
- },
53
- alias: {
54
- map: [['@', path.resolve(import.meta.dirname, './src')]],
55
- extensions: ['.js', '.jsx', '.ts', '.d.ts', '.tsx'],
56
- },
57
- },
58
- },
59
- rules: {
60
- 'import/no-extraneous-dependencies': 'off',
61
- '@typescript-eslint/keyword-spacing': 'off',
62
- 'import/prefer-default-export': 'off',
63
- 'import/extensions': 'off',
64
- '@typescript-eslint/no-explicit-any': ['warn'],
65
- '@typescript-eslint/no-var-requires': ['warn'],
66
- '@typescript-eslint/consistent-type-imports': 'warn',
67
- 'no-undef': 'error',
68
- '@typescript-eslint/no-unused-vars': [
69
- 'error',
70
- {
71
- argsIgnorePattern: '^_',
72
- varsIgnorePattern: '^_',
73
- caughtErrorsIgnorePattern: '^_',
74
- },
75
- ],
76
- 'unicorn/prevent-abbreviations': 'off',
77
- 'unicorn/no-null': 'off',
78
- 'import/order': [
79
- 'warn',
80
- {
81
- alphabetize: {
82
- caseInsensitive: true,
83
- order: 'asc',
84
- },
85
- groups: ['builtin', 'external', 'index', 'sibling', 'parent', 'internal', 'type'],
86
- pathGroups: [
87
- {
88
- pattern: 'react',
89
- group: 'external',
90
- position: 'before',
91
- },
92
- ],
93
- pathGroupsExcludedImportTypes: ['types'],
94
- 'newlines-between': 'always',
95
- },
96
- ],
97
- 'import/no-named-as-default-member': 'off',
98
- 'unicorn/filename-case': [
99
- 'error',
100
- {
101
- cases: {
102
- camelCase: true,
103
- pascalCase: true,
104
- kebabCase: true,
105
- },
106
- },
107
- ],
108
- 'unicorn/consistent-function-scoping': 'off',
109
- },
110
- },
111
- ];
112
-
113
- export default eslintConfig;
package/src/gallery.ts DELETED
@@ -1,124 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- /** Zod schema for thumbnail metadata including path and dimensions */
4
- export const ThumbnailSchema = z.object({
5
- path: z.string(),
6
- pathRetina: z.string(),
7
- width: z.number(),
8
- height: z.number(),
9
- blurHash: z.string().optional(),
10
- });
11
-
12
- /** Zod schema for media file metadata including type, dimensions, and thumbnail info */
13
- export const MediaFileSchema = z.object({
14
- type: z.enum(['image', 'video']),
15
- filename: z.string(),
16
- alt: z.string().optional(),
17
- width: z.number(),
18
- height: z.number(),
19
- thumbnail: ThumbnailSchema.optional(),
20
- lastMediaTimestamp: z.string().optional(),
21
- });
22
-
23
- /** Zod schema for media file with path (deprecated) */
24
- export const MediaFileDeprecatedSchema = z.object({
25
- type: z.enum(['image', 'video']),
26
- path: z.string(),
27
- alt: z.string().optional(),
28
- width: z.number(),
29
- height: z.number(),
30
- thumbnail: ThumbnailSchema.optional(),
31
- lastMediaTimestamp: z.string().optional(),
32
- });
33
-
34
- /** Zod schema for a gallery section containing title, description, and media files */
35
- export const GallerySectionSchema = z.object({
36
- title: z.string().optional(),
37
- description: z.string().optional(),
38
- images: z.array(MediaFileSchema),
39
- });
40
-
41
- /** Zod schema for a gallery section containing title, description, and media files (deprecated) */
42
- export const GallerySectionDeprecatedSchema = z.object({
43
- title: z.string().optional(),
44
- description: z.string().optional(),
45
- images: z.array(MediaFileDeprecatedSchema),
46
- });
47
-
48
- /** Zod schema for sub-gallery metadata including title, header image, and path */
49
- export const SubGallerySchema = z.object({
50
- title: z.string(),
51
- headerImage: z.string(),
52
- path: z.string(),
53
- });
54
-
55
- /** Zod schema for complete gallery data including metadata, sections, and sub-galleries */
56
- export const GalleryMetadataSchema = z.object({
57
- image: z.string().optional(),
58
- imageWidth: z.number().optional(),
59
- imageHeight: z.number().optional(),
60
- ogUrl: z.string().optional(),
61
- ogType: z.string().optional(),
62
- ogSiteName: z.string().optional(),
63
- twitterSite: z.string().optional(),
64
- twitterCreator: z.string().optional(),
65
- author: z.string().optional(),
66
- keywords: z.string().optional(),
67
- canonicalUrl: z.string().optional(),
68
- language: z.string().optional(),
69
- robots: z.string().optional(),
70
- });
71
-
72
- /** Zod schema for complete gallery data including metadata, sections, and sub-galleries */
73
- export const GalleryDataSchema = z.object({
74
- title: z.string(),
75
- description: z.string(),
76
- mediaBasePath: z.string().optional(),
77
- url: z.string().optional(),
78
- headerImage: z.string(),
79
- headerImageBlurHash: z.string().optional(),
80
- thumbnailSize: z.number().optional(),
81
- metadata: GalleryMetadataSchema,
82
- mediaBaseUrl: z.string().optional(),
83
- thumbsBaseUrl: z.string().optional(),
84
- analyticsScript: z.string().optional(),
85
- sections: z.array(GallerySectionSchema),
86
- subGalleries: z.object({ title: z.string(), galleries: z.array(SubGallerySchema) }),
87
- });
88
-
89
- /** Zod schema for complete gallery data without mediaBasePath (deprecated) */
90
- export const GalleryDataDeprecatedSchema = z.object({
91
- title: z.string(),
92
- description: z.string(),
93
- url: z.string().optional(),
94
- headerImage: z.string(),
95
- thumbnailSize: z.number().optional(),
96
- metadata: GalleryMetadataSchema,
97
- mediaBaseUrl: z.string().optional(),
98
- analyticsScript: z.string().optional(),
99
- sections: z.array(GallerySectionDeprecatedSchema),
100
- subGalleries: z.object({ title: z.string(), galleries: z.array(SubGallerySchema) }),
101
- });
102
-
103
- /** TypeScript type for thumbnail metadata */
104
- export type Thumbnail = z.infer<typeof ThumbnailSchema>;
105
-
106
- /** TypeScript type for media file metadata */
107
- export type MediaFile = z.infer<typeof MediaFileSchema>;
108
-
109
- /** TypeScript type for gallery section data */
110
- export type GallerySection = z.infer<typeof GallerySectionSchema>;
111
-
112
- /** TypeScript type for sub-gallery metadata */
113
- export type SubGallery = z.infer<typeof SubGallerySchema>;
114
-
115
- /** TypeScript type for gallery metadata */
116
- export type GalleryMetadata = z.infer<typeof GalleryMetadataSchema>;
117
-
118
- /** TypeScript type for complete gallery data structure */
119
- export type GalleryData = z.infer<typeof GalleryDataSchema>;
120
-
121
- /** Deprecated types */
122
- export type MediaFileWithPath = z.infer<typeof MediaFileDeprecatedSchema>;
123
- export type GallerySectionDeprecated = z.infer<typeof GallerySectionDeprecatedSchema>;
124
- export type GalleryDataDeprecated = z.infer<typeof GalleryDataDeprecatedSchema>;
package/tsconfig.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "../tsconfig.json",
3
- "compilerOptions": {
4
- "noEmit": true
5
- },
6
- "include": ["src/**/*.ts", "tsup.config.ts"]
7
- }
package/tsup.config.ts DELETED
@@ -1,15 +0,0 @@
1
- import { defineConfig } from 'tsup';
2
-
3
- export default defineConfig({
4
- entry: ['src/gallery.ts'],
5
- format: ['esm', 'cjs'],
6
- dts: true,
7
- splitting: false,
8
- sourcemap: true,
9
- clean: true,
10
- minify: false,
11
- target: 'node20',
12
- outDir: 'dist',
13
- treeshake: true,
14
- external: ['zod'],
15
- });