mirror of
				https://github.com/Dan6erbond/sk-auth.git
				synced 2025-10-26 10:22:56 +01:00 
			
		
		
		
	use svelte build way
This commit is contained in:
		
							parent
							
								
									ec0ad24b39
								
							
						
					
					
						commit
						828feb7ecc
					
				
							
								
								
									
										6
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -76,4 +76,8 @@ typings/
 | 
				
			|||||||
.fusebox/
 | 
					.fusebox/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Build output
 | 
					# Build output
 | 
				
			||||||
dist/*
 | 
					/index.*ts
 | 
				
			||||||
 | 
					/index.*js
 | 
				
			||||||
 | 
					/providers
 | 
				
			||||||
 | 
					/client
 | 
				
			||||||
 | 
					/types
 | 
				
			||||||
 | 
				
			|||||||
@ -3441,12 +3441,6 @@ simple-swizzle@^0.2.2:
 | 
				
			|||||||
    cookie "^0.4.1"
 | 
					    cookie "^0.4.1"
 | 
				
			||||||
    jsonwebtoken "^8.5.1"
 | 
					    jsonwebtoken "^8.5.1"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"sk-auth@file:../":
 | 
					 | 
				
			||||||
  version "0.3.7"
 | 
					 | 
				
			||||||
  dependencies:
 | 
					 | 
				
			||||||
    cookie "^0.4.1"
 | 
					 | 
				
			||||||
    jsonwebtoken "^8.5.1"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
slash@^3.0.0:
 | 
					slash@^3.0.0:
 | 
				
			||||||
  version "3.0.0"
 | 
					  version "3.0.0"
 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
 | 
					  resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
  "internal": true,
 | 
					 | 
				
			||||||
  "main": "../dist/client/index.js",
 | 
					 | 
				
			||||||
  "module": "../dist/client/index.esm.js",
 | 
					 | 
				
			||||||
  "types": "../dist/client/index.d.ts"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										33
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								package.json
									
									
									
									
									
								
							@ -2,14 +2,23 @@
 | 
				
			|||||||
  "name": "sk-auth",
 | 
					  "name": "sk-auth",
 | 
				
			||||||
  "version": "0.3.7",
 | 
					  "version": "0.3.7",
 | 
				
			||||||
  "description": "Authentication library for use with SvelteKit featuring built-in OAuth providers and zero restriction customization!",
 | 
					  "description": "Authentication library for use with SvelteKit featuring built-in OAuth providers and zero restriction customization!",
 | 
				
			||||||
  "main": "dist/index.js",
 | 
					  "module": "index.mjs",
 | 
				
			||||||
  "module": "dist/index.esm.js",
 | 
					  "main": "index",
 | 
				
			||||||
  "types": "dist/index.d.ts",
 | 
					  "types": "types/index.d.ts",
 | 
				
			||||||
  "exports": {
 | 
					  "exports": {
 | 
				
			||||||
    ".": "./dist/index.js",
 | 
					    "./package.json": "./package.json",
 | 
				
			||||||
    "./client": "./dist/client/index.js",
 | 
					    ".": {
 | 
				
			||||||
    "./providers": "./dist/providers/index.js",
 | 
					      "import": "./index.mjs",
 | 
				
			||||||
    "./package.json": "./package.json"
 | 
					      "require": "./index.js"
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "./providers": {
 | 
				
			||||||
 | 
					      "import": "./providers/index.mjs",
 | 
				
			||||||
 | 
					      "require": "./providers/index.js"
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "./client": {
 | 
				
			||||||
 | 
					      "import": "./client/index.mjs",
 | 
				
			||||||
 | 
					      "require": "./client/index.js"
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "files": [
 | 
					  "files": [
 | 
				
			||||||
    "dist",
 | 
					    "dist",
 | 
				
			||||||
@ -18,7 +27,8 @@
 | 
				
			|||||||
    "README.md"
 | 
					    "README.md"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "build": "rollup --config",
 | 
					    "build": "rollup -c && npm run tsd",
 | 
				
			||||||
 | 
					    "tsd": "tsc -p ./src --emitDeclarationOnly",
 | 
				
			||||||
    "dev": "rollup --config --watch",
 | 
					    "dev": "rollup --config --watch",
 | 
				
			||||||
    "test": "echo \"Error: no test specified\" && exit 1",
 | 
					    "test": "echo \"Error: no test specified\" && exit 1",
 | 
				
			||||||
    "lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
 | 
					    "lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
 | 
				
			||||||
@ -51,20 +61,15 @@
 | 
				
			|||||||
    "@types/jsonwebtoken": "^8.5.1",
 | 
					    "@types/jsonwebtoken": "^8.5.1",
 | 
				
			||||||
    "@typescript-eslint/eslint-plugin": "^4.23.0",
 | 
					    "@typescript-eslint/eslint-plugin": "^4.23.0",
 | 
				
			||||||
    "@typescript-eslint/parser": "^4.23.0",
 | 
					    "@typescript-eslint/parser": "^4.23.0",
 | 
				
			||||||
    "build-esm": "^4.2.2",
 | 
					 | 
				
			||||||
    "esbuild": "^0.12.1",
 | 
					 | 
				
			||||||
    "eslint": "^7.26.0",
 | 
					    "eslint": "^7.26.0",
 | 
				
			||||||
    "eslint-config-prettier": "^8.3.0",
 | 
					    "eslint-config-prettier": "^8.3.0",
 | 
				
			||||||
    "prettier": "^2.3.0",
 | 
					    "prettier": "^2.3.0",
 | 
				
			||||||
    "rollup": "^2.48.0",
 | 
					    "rollup": "^2.48.0",
 | 
				
			||||||
    "rollup-plugin-esbuild": "^4.2.3",
 | 
					 | 
				
			||||||
    "rollup-plugin-multi-input": "^1.3.0",
 | 
					 | 
				
			||||||
    "svelte": "^3.38.2",
 | 
					    "svelte": "^3.38.2",
 | 
				
			||||||
    "tslib": "^2.2.0",
 | 
					    "tslib": "^2.2.0",
 | 
				
			||||||
    "typescript": "^4.2.4"
 | 
					    "typescript": "^4.2.4"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "peerDependencies": {
 | 
					  "peerDependencies": {
 | 
				
			||||||
    "@sveltejs/kit": "next",
 | 
					    "@sveltejs/kit": "next"
 | 
				
			||||||
    "build-esm": "^4.2.2"
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
  "internal": true,
 | 
					 | 
				
			||||||
  "main": "../dist/providers/index.js",
 | 
					 | 
				
			||||||
  "module": "../dist/providers/index.esm.js",
 | 
					 | 
				
			||||||
  "types": "../dist/providers/index.d.ts"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,57 +1,43 @@
 | 
				
			|||||||
import multiInput from "rollup-plugin-multi-input";
 | 
					import fs from 'fs';
 | 
				
			||||||
import packageJson from "./package.json";
 | 
					import typescript from '@rollup/plugin-typescript';
 | 
				
			||||||
import esbuild from "rollup-plugin-esbuild";
 | 
					import pkg from "./package.json";
 | 
				
			||||||
import typescript from "@rollup/plugin-typescript";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const globals = {
 | 
					const ts_plugin = typescript({ include: 'src/**', typescript: require('typescript') });
 | 
				
			||||||
  ...packageJson.dependencies,
 | 
					 | 
				
			||||||
  ...packageJson.devDependencies,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** @type {import('rollup').RollupOptions} */
 | 
					function config(dir) {
 | 
				
			||||||
const baseConfig = {
 | 
					  const _dir = dir ? dir + '/' : '';
 | 
				
			||||||
  input: ["src/**/*.ts"],
 | 
					  return {
 | 
				
			||||||
  output: {
 | 
					    input: `src/${_dir}index.ts`,
 | 
				
			||||||
    dir: "dist",
 | 
					    output: [
 | 
				
			||||||
    sourcemap: true,
 | 
					      {
 | 
				
			||||||
 | 
					        file: `${_dir}index.mjs`,
 | 
				
			||||||
 | 
					        format: 'esm'
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        file: `${_dir}index.js`,
 | 
				
			||||||
 | 
					        format: 'cjs'
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
    plugins: [
 | 
					    plugins: [
 | 
				
			||||||
    esbuild(),
 | 
					      typescript({ include: 'src/**', typescript: require('typescript') }),
 | 
				
			||||||
    typescript({
 | 
					      {
 | 
				
			||||||
      emitDeclarationOnly: true,
 | 
					        writeBundle() {
 | 
				
			||||||
      sourceMap: false,
 | 
					          if (dir) {
 | 
				
			||||||
    }),
 | 
					            fs.writeFileSync(`${_dir}/package.json`, JSON.stringify({
 | 
				
			||||||
 | 
					              main: './index',
 | 
				
			||||||
 | 
					              module: './index.mjs',
 | 
				
			||||||
 | 
					              types: './index.d.ts'
 | 
				
			||||||
 | 
					            }, null, '  '));
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					          fs.writeFileSync(`${_dir}index.d.ts`, `export * from '../types/${_dir}index';`);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
  external: [
 | 
					    external: [...Object.keys(pkg.dependencies)]
 | 
				
			||||||
    ...Object.keys(globals),
 | 
					  }
 | 
				
			||||||
    "@sveltejs/kit/assets/runtime/app/navigation",
 | 
					}
 | 
				
			||||||
    "@sveltejs/kit/assets/runtime/app/stores",
 | 
					
 | 
				
			||||||
  ],
 | 
					
 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** @type {Array.<import('rollup').RollupOptions>} */
 | 
					/** @type {Array.<import('rollup').RollupOptions>} */
 | 
				
			||||||
export default [
 | 
					export default [config(), config('providers'), config('client')]
 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    ...baseConfig,
 | 
					 | 
				
			||||||
    output: {
 | 
					 | 
				
			||||||
      ...baseConfig.output,
 | 
					 | 
				
			||||||
      format: "cjs",
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    plugins: [...baseConfig.plugins, multiInput()],
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    ...baseConfig,
 | 
					 | 
				
			||||||
    output: {
 | 
					 | 
				
			||||||
      ...baseConfig.output,
 | 
					 | 
				
			||||||
      format: "esm",
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    plugins: [
 | 
					 | 
				
			||||||
      ...baseConfig.plugins,
 | 
					 | 
				
			||||||
      multiInput({
 | 
					 | 
				
			||||||
        /** @param {string} output */
 | 
					 | 
				
			||||||
        transformOutputPath: (output) =>
 | 
					 | 
				
			||||||
          `${output.split(".").slice(0, -1).join(".")}.esm.${output.split(".").slice(-1)}`,
 | 
					 | 
				
			||||||
      }),
 | 
					 | 
				
			||||||
    ],
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
];
 | 
					 | 
				
			||||||
							
								
								
									
										11
									
								
								src/tsconfig.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/tsconfig.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					  "extends": "../tsconfig.json",
 | 
				
			||||||
 | 
					  "include": [
 | 
				
			||||||
 | 
					    "."
 | 
				
			||||||
 | 
					  ],
 | 
				
			||||||
 | 
					  "compilerOptions": {
 | 
				
			||||||
 | 
					    "target": "ESNext",
 | 
				
			||||||
 | 
					    "types": [],
 | 
				
			||||||
 | 
					    "baseUrl": ".",
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -6,6 +6,7 @@
 | 
				
			|||||||
    "moduleResolution": "node",
 | 
					    "moduleResolution": "node",
 | 
				
			||||||
    "noImplicitAny": false,
 | 
					    "noImplicitAny": false,
 | 
				
			||||||
    "declaration": true,
 | 
					    "declaration": true,
 | 
				
			||||||
 | 
							"declarationDir": "types",
 | 
				
			||||||
    "removeComments": true,
 | 
					    "removeComments": true,
 | 
				
			||||||
    "emitDecoratorMetadata": true,
 | 
					    "emitDecoratorMetadata": true,
 | 
				
			||||||
    "experimentalDecorators": true,
 | 
					    "experimentalDecorators": true,
 | 
				
			||||||
@ -13,9 +14,7 @@
 | 
				
			|||||||
    "esModuleInterop": true,
 | 
					    "esModuleInterop": true,
 | 
				
			||||||
    "allowSyntheticDefaultImports": true,
 | 
					    "allowSyntheticDefaultImports": true,
 | 
				
			||||||
    "sourceMap": true,
 | 
					    "sourceMap": true,
 | 
				
			||||||
    "baseUrl": "./",
 | 
					 | 
				
			||||||
    "outDir": "./dist"
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "include": ["src/**/*"],
 | 
					  "include": ["src/**/*"],
 | 
				
			||||||
  "exclude": ["**/node_modules", "**/dist", "./app", "**/*.md", "**/rollup.config.js"]
 | 
					  "exclude": ["**/node_modules", "./app", "**/*.md", "**/rollup.config.js"]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user