kishare 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": "kishare",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "description": "CLI tool for generating static KiCad project viewer sites",
6
6
  "homepage": "https://github.com/hmcty/kishare",
@@ -13,12 +13,9 @@
13
13
  "vite"
14
14
  ],
15
15
  "files": [
16
- "bin",
17
- "src",
18
- "vendor/kicanvas/build",
19
- "index.html",
20
- "vite.config.ts",
21
- "tsconfig.json"
16
+ "bin/",
17
+ "src/",
18
+ "vendor/kicanvas/build/kicanvas.js"
22
19
  ],
23
20
  "scripts": {
24
21
  "setup": "cd ./vendor/kicanvas && npm install && npm run build",
@@ -51,7 +48,7 @@
51
48
  "vite": "^5.2.8",
52
49
  "kicanvas": "file:vendor/kicanvas"
53
50
  },
54
- "bundleDependencies": [
51
+ "bundledDependencies": [
55
52
  "kicanvas"
56
53
  ]
57
54
  }
package/index.html DELETED
@@ -1,15 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob:; connect-src 'self'; font-src 'self' https://fonts.gstatic.com; worker-src 'self' blob:; object-src 'none'; base-uri 'self'; form-action 'self';">
7
- <title>KiShare Workspace</title>
8
- </head>
9
- <body>
10
- <workspace-app></workspace-app>
11
-
12
- <script type="module" src="/kicanvas/kicanvas.js"></script>
13
- <script type="module" src="/src/main.ts"></script>
14
- </body>
15
- </html>
package/tsconfig.json DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "useDefineForClassFields": true,
5
- "module": "ESNext",
6
- "lib": ["ES2020", "DOM", "DOM.Iterable"],
7
- "skipLibCheck": true,
8
-
9
- /* Bundler mode */
10
- "moduleResolution": "bundler",
11
- "allowImportingTsExtensions": true,
12
- "resolveJsonModule": true,
13
- "isolatedModules": true,
14
- "noEmit": true,
15
-
16
- /* Linting */
17
- "strict": true,
18
- "noUnusedLocals": true,
19
- "noUnusedParameters": true,
20
- "noFallthroughCasesInSwitch": true,
21
- "esModuleInterop": true,
22
- "allowSyntheticDefaultImports": true,
23
- "forceConsistentCasingInFileNames": true
24
- },
25
- "include": ["src"]
26
- }
@@ -1,48 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig to read more about this file */
4
- /* Language and Environment */
5
- "target": "es2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
6
- "moduleResolution": "bundler",
7
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
8
- "experimentalDecorators": true,
9
- "useDefineForClassFields": false, // Required to use experimental decorators
10
- /* Modules */
11
- "module": "es2022" /* Specify what module code is generated. */,
12
- "allowImportingTsExtensions": true,
13
- "verbatimModuleSyntax": true,
14
- "allowArbitraryExtensions": true,
15
- /* JavaScript Support */
16
- "allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */,
17
- "checkJs": true /* Enable error reporting in type-checked JavaScript files. */,
18
- /* Emit */
19
- // "outDir": "./build", /* Specify an output folder for all emitted files. */
20
- // "sourceMap": true,
21
- "noEmit": true /* Disable emitting files from a compilation. */,
22
- /* Interop Constraints */
23
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
24
- "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
25
- /* Type Checking */
26
- // "strict": true, /* Enable all strict type-checking options. */
27
- "noImplicitAny": true /* Enable error reporting for expressions and declarations with an implied 'any' type. */,
28
- "strictNullChecks": true /* When type checking, take into account 'null' and 'undefined'. */,
29
- "strictFunctionTypes": true /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */,
30
- "strictBindCallApply": true /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */,
31
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
32
- "noImplicitThis": true /* Enable error reporting when 'this' is given the type 'any'. */,
33
- "useUnknownInCatchVariables": true /* Default catch clause variables as 'unknown' instead of 'any'. */,
34
- "alwaysStrict": true /* Ensure 'use strict' is always emitted. */,
35
- "noUnusedLocals": true /* Enable error reporting when local variables aren't read. */,
36
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
37
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
38
- "noImplicitReturns": true /* Enable error reporting for codepaths that do not explicitly return in a function. */,
39
- "noFallthroughCasesInSwitch": true /* Enable error reporting for fallthrough cases in switch statements. */,
40
- "noUncheckedIndexedAccess": true /* Add 'undefined' to a type when accessed using an index. */,
41
- "noImplicitOverride": true /* Ensure overriding members in derived classes are marked with an override modifier. */,
42
- "noPropertyAccessFromIndexSignature": true /* Enforces using indexed accessors for keys declared using an indexed type. */,
43
- "allowUnusedLabels": false,
44
- "allowUnreachableCode": false,
45
- },
46
- "include": ["./src/**/*", "./test/**/*"],
47
- "exclude": ["./node_modules", "./**/node_modules/*", "./scripts/"],
48
- }
package/vite.config.ts DELETED
@@ -1,69 +0,0 @@
1
- import { defineConfig } from 'vite';
2
- import fs from 'fs';
3
- import path from 'path';
4
- import { fileURLToPath } from 'url';
5
-
6
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
-
8
- // When used via CLI, KISHARE_PROJECT_ROOT points to user's project
9
- // Build output goes to user's project/dist by default
10
- const projectRoot = process.env.KISHARE_PROJECT_ROOT || __dirname;
11
- const defaultOutDir = path.join(projectRoot, 'dist');
12
-
13
- export default defineConfig({
14
- base: "",
15
- build: {
16
- outDir: defaultOutDir,
17
- assetsDir: 'assets',
18
- sourcemap: true,
19
- },
20
- server: {
21
- port: 5173,
22
- open: true,
23
- middlewareMode: false,
24
- },
25
- publicDir: 'public',
26
- appType: 'spa',
27
- plugins: [
28
- {
29
- name: 'serve-public-files',
30
- configureServer(server) {
31
- server.middlewares.use((req, res, next) => {
32
- // Serve files from public directory for specific extensions
33
- if (req.url?.match(/\.(kicad_pro|kicad_sch|kicad_pcb|zip|png|jpg|jpeg|gif|svg|webp|md)$/i)) {
34
- // Security: Normalize path and prevent directory traversal
35
- const requestedPath = req.url.split('?')[0]; // Remove query params
36
- const filePath = path.normalize(path.join(__dirname, 'public', requestedPath));
37
- // Ensure the resolved path is within public directory
38
- const publicDir = path.join(__dirname, 'public');
39
- if (!filePath.startsWith(publicDir)) {
40
- res.statusCode = 403;
41
- res.end('Forbidden');
42
- return;
43
- }
44
-
45
- if (fs.existsSync(filePath) && fs.statSync(filePath).isFile()) {
46
- const content = fs.readFileSync(filePath);
47
-
48
- // Set appropriate Content-Type header
49
- let contentType = 'application/octet-stream';
50
- if (req.url.endsWith('.zip')) contentType = 'application/zip';
51
- else if (req.url.match(/\.(kicad_pro|kicad_sch|kicad_pcb)$/)) contentType = 'application/json';
52
- else if (req.url.endsWith('.png')) contentType = 'image/png';
53
- else if (req.url.match(/\.(jpg|jpeg)$/)) contentType = 'image/jpeg';
54
- else if (req.url.endsWith('.gif')) contentType = 'image/gif';
55
- else if (req.url.endsWith('.svg')) contentType = 'image/svg+xml';
56
- else if (req.url.endsWith('.webp')) contentType = 'image/webp';
57
- else if (req.url.endsWith('.md')) contentType = 'text/markdown';
58
-
59
- res.setHeader('Content-Type', contentType);
60
- res.end(content);
61
- return;
62
- }
63
- }
64
- next();
65
- });
66
- },
67
- },
68
- ],
69
- });