create-packer 1.25.17 → 1.25.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-packer",
3
- "version": "1.25.17",
3
+ "version": "1.25.18",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",
@@ -0,0 +1,58 @@
1
+ {
2
+ "root": true,
3
+ "plugins": ["@typescript-eslint"],
4
+ "extends": [
5
+ "eslint:recommended",
6
+ "plugin:@typescript-eslint/recommended",
7
+ "plugin:svelte/recommended",
8
+ "prettier",
9
+ "plugin:import/recommended",
10
+ "plugin:import/typescript"
11
+ ],
12
+ "parser": "@typescript-eslint/parser",
13
+ "parserOptions": {
14
+ "sourceType": "module",
15
+ "ecmaVersion": 2020,
16
+ "extraFileExtensions": [".svelte"]
17
+ },
18
+ "settings": {
19
+ "import/resolver": {
20
+ "typescript": true,
21
+ "node": true
22
+ }
23
+ },
24
+ "env": {
25
+ "browser": true,
26
+ "es2017": true,
27
+ "node": true
28
+ },
29
+ "overrides": [
30
+ {
31
+ "files": ["*.svelte"],
32
+ "parser": "svelte-eslint-parser",
33
+ "parserOptions": {
34
+ "parser": "@typescript-eslint/parser"
35
+ }
36
+ }
37
+ ],
38
+ "rules": {
39
+ "import/export": "off",
40
+ "import/namespace": "off",
41
+ "import/default": "off",
42
+ "import/order": [
43
+ "error",
44
+ {
45
+ "groups": [
46
+ "builtin",
47
+ "external",
48
+ "internal",
49
+ "parent",
50
+ "sibling",
51
+ "index",
52
+ "object",
53
+ "type"
54
+ ]
55
+ }
56
+ ]
57
+ }
58
+ }
@@ -1,9 +1,14 @@
1
1
  {
2
- "useTabs": true,
3
- "singleQuote": true,
4
- "trailingComma": "none",
5
- "printWidth": 100,
6
- "plugins": ["prettier-plugin-svelte"],
7
- "pluginSearchDirs": ["."],
8
- "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
2
+ "plugins": ["prettier-plugin-svelte"],
3
+ "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }],
4
+ "printWidth": 100,
5
+ "tabWidth": 4,
6
+ "useTabs": false,
7
+ "semi": false,
8
+ "singleQuote": true,
9
+ "trailingComma": "none",
10
+ "bracketSpacing": true,
11
+ "bracketSameLine": false,
12
+ "arrowParens": "avoid",
13
+ "rangeStart": 0
9
14
  }
@@ -1,31 +1,38 @@
1
1
  {
2
- "name": "svelte",
3
- "version": "0.0.1",
4
- "private": true,
5
- "scripts": {
6
- "dev": "vite dev",
7
- "build": "vite build",
8
- "preview": "vite preview",
9
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
10
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
11
- "lint": "prettier --plugin-search-dir . --check . && eslint .",
12
- "format": "prettier --plugin-search-dir . --write ."
13
- },
14
- "devDependencies": {
15
- "@sveltejs/adapter-auto": "2.1.0",
16
- "@sveltejs/kit": "1.25.0",
17
- "@typescript-eslint/eslint-plugin": "6.7.2",
18
- "@typescript-eslint/parser": "6.7.2",
19
- "eslint": "8.50.0",
20
- "eslint-config-prettier": "9.0.0",
21
- "eslint-plugin-svelte": "2.33.2",
22
- "prettier": "3.0.3",
23
- "prettier-plugin-svelte": "3.0.3",
24
- "svelte": "4.2.1",
25
- "svelte-check": "3.5.2",
26
- "tslib": "2.6.2",
27
- "typescript": "5.2.2",
28
- "vite": "4.4.9"
29
- },
30
- "type": "module"
2
+ "name": "svelte",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "npm run check && npm run lint && vite build",
9
+ "build:analyse": "npm run check && npm run lint && vite build --mode analyse",
10
+ "preview": "vite preview",
11
+ "up:vite": "pnpm up vite @vitejs/* -L",
12
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
13
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
14
+ "lint": "eslint .",
15
+ "format": "prettier --plugin-search-dir . --write ."
16
+ },
17
+ "devDependencies": {
18
+ "@sveltejs/adapter-auto": "2.1.0",
19
+ "@sveltejs/kit": "1.25.0",
20
+ "@types/lodash-es": "^4.17.9",
21
+ "@typescript-eslint/eslint-plugin": "6.7.2",
22
+ "@typescript-eslint/parser": "6.7.2",
23
+ "eslint": "8.50.0",
24
+ "eslint-config-prettier": "9.0.0",
25
+ "eslint-plugin-import": "2.27.5",
26
+ "eslint-plugin-svelte": "2.33.2",
27
+ "prettier": "3.0.3",
28
+ "prettier-plugin-svelte": "3.0.3",
29
+ "svelte-check": "3.5.2",
30
+ "tslib": "2.6.2",
31
+ "typescript": "5.2.2",
32
+ "vite": "4.4.9"
33
+ },
34
+ "dependencies": {
35
+ "lodash-es": "4.17.21",
36
+ "svelte": "^4.2.1"
37
+ }
31
38
  }
@@ -0,0 +1,26 @@
1
+ import { concat, forEach, isArray, isRegExp, keys, remove, size } from 'lodash-es'
2
+ import pkg from '../package.json'
3
+
4
+ export function createChunks(chunks: { [key: string]: Array<string | RegExp> }) {
5
+ const vendor = keys(pkg.dependencies)
6
+ const result: { [key: string]: string[] } = {}
7
+
8
+ forEach(chunks, (values, key) => {
9
+ if (!isArray(result[key])) {
10
+ result[key] = []
11
+ }
12
+ forEach(values, value => {
13
+ let modules: string[] = []
14
+ if (isRegExp(value)) {
15
+ modules = remove(vendor, name => value.test(name))
16
+ } else {
17
+ modules = remove(vendor, name => name === value)
18
+ }
19
+ if (size(modules) > 0) {
20
+ result[key] = concat(result[key], modules)
21
+ }
22
+ })
23
+ })
24
+ result.vendor = vendor
25
+ return result
26
+ }
@@ -0,0 +1 @@
1
+ export * from './createChunks'
@@ -1,18 +1,18 @@
1
- import adapter from '@sveltejs/adapter-auto';
2
- import { vitePreprocess } from '@sveltejs/kit/vite';
1
+ import adapter from '@sveltejs/adapter-auto'
2
+ import { vitePreprocess } from '@sveltejs/kit/vite'
3
3
 
4
4
  /** @type {import('@sveltejs/kit').Config} */
5
5
  const config = {
6
- // Consult https://kit.svelte.dev/docs/integrations#preprocessors
7
- // for more information about preprocessors
8
- preprocess: vitePreprocess(),
6
+ // Consult https://kit.svelte.dev/docs/integrations#preprocessors
7
+ // for more information about preprocessors
8
+ preprocess: vitePreprocess(),
9
9
 
10
- kit: {
11
- // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
12
- // If your environment is not supported or you settled on a specific environment, switch out the adapter.
13
- // See https://kit.svelte.dev/docs/adapters for more information about adapters.
14
- adapter: adapter()
15
- }
16
- };
10
+ kit: {
11
+ // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
12
+ // If your environment is not supported or you settled on a specific environment, switch out the adapter.
13
+ // See https://kit.svelte.dev/docs/adapters for more information about adapters.
14
+ adapter: adapter()
15
+ }
16
+ }
17
17
 
18
- export default config;
18
+ export default config
@@ -1,6 +1,41 @@
1
- import { sveltekit } from '@sveltejs/kit/vite';
2
- import { defineConfig } from 'vite';
1
+ import { defineConfig, loadEnv } from 'vite'
2
+ import { sveltekit } from '@sveltejs/kit/vite'
3
+ import { includes } from 'lodash-es'
4
+ import { createChunks } from './scripts'
3
5
 
4
- export default defineConfig({
5
- plugins: [sveltekit()]
6
- });
6
+ export default defineConfig(({ mode }) => {
7
+ const env = loadEnv(mode, process.cwd(), '')
8
+ return {
9
+ base: env.VITE_BASE_URL,
10
+ plugins: [sveltekit()],
11
+ resolve: {
12
+ alias: {
13
+ '@': __dirname
14
+ }
15
+ },
16
+ esbuild: {
17
+ drop: includes(['production', 'analyse'], mode) ? ['console', 'debugger'] : []
18
+ },
19
+ build: {
20
+ sourcemap: mode === 'analyse',
21
+ reportCompressedSize: mode === 'analyse',
22
+ rollupOptions: {
23
+ output: {
24
+ manualChunks: createChunks({
25
+ sveltejs: ['sveltejs']
26
+ })
27
+ }
28
+ }
29
+ },
30
+ server: {
31
+ host: '0.0.0.0',
32
+ proxy: {
33
+ '/dev/api': {
34
+ target: 'http://127.0.0.1',
35
+ changeOrigin: true,
36
+ rewrite: path => path.replace(/^\/dev\/api/, '')
37
+ }
38
+ }
39
+ }
40
+ }
41
+ })
@@ -1,30 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- extends: [
4
- 'eslint:recommended',
5
- 'plugin:@typescript-eslint/recommended',
6
- 'plugin:svelte/recommended',
7
- 'prettier'
8
- ],
9
- parser: '@typescript-eslint/parser',
10
- plugins: ['@typescript-eslint'],
11
- parserOptions: {
12
- sourceType: 'module',
13
- ecmaVersion: 2020,
14
- extraFileExtensions: ['.svelte']
15
- },
16
- env: {
17
- browser: true,
18
- es2017: true,
19
- node: true
20
- },
21
- overrides: [
22
- {
23
- files: ['*.svelte'],
24
- parser: 'svelte-eslint-parser',
25
- parserOptions: {
26
- parser: '@typescript-eslint/parser'
27
- }
28
- }
29
- ]
30
- };
@@ -1,13 +0,0 @@
1
- .DS_Store
2
- node_modules
3
- /build
4
- /.svelte-kit
5
- /package
6
- .env
7
- .env.*
8
- !.env.example
9
-
10
- # Ignore files for PNPM, NPM and YARN
11
- pnpm-lock.yaml
12
- package-lock.json
13
- yarn.lock