@jgphilpott/polytree 0.0.7 → 0.0.8

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/README.md CHANGED
@@ -8,10 +8,16 @@
8
8
 
9
9
  ## Getting Started
10
10
 
11
+ ### Node.js
12
+
13
+ ##### Install
14
+
11
15
  ```bash
12
16
  npm install polytree
13
17
  ```
14
18
 
19
+ ##### Import
20
+
15
21
  ```js
16
22
  import * as THREE from 'three';
17
23
  import { Polytree } from 'polytree';
@@ -19,6 +25,30 @@ import { Polytree } from 'polytree';
19
25
  // Example usage coming soon!
20
26
  ```
21
27
 
28
+ ### Browser
29
+
30
+ For browser usage, use the ES module-compatible bundle:
31
+
32
+ ```html
33
+ <script type="importmap">
34
+ {
35
+ "imports": {
36
+ "three": "./path/to/three.module.min.js",
37
+ "polytree": "./path/to/polytree.bundle.browser.js"
38
+ }
39
+ }
40
+ </script>
41
+
42
+ <script type="module">
43
+ import * as THREE from 'three';
44
+ import Polytree from 'polytree';
45
+
46
+ // Example usage coming soon!
47
+ </script>
48
+ ```
49
+
50
+ The browser bundle (`polytree.bundle.browser.js`) is specifically designed for ES module imports in browsers, while the main bundle (`polytree.bundle.js`) is for Node.js environments.
51
+
22
52
  ## Applications
23
53
 
24
54
  - 3D modeling and design for 3D printing.
@@ -31,4 +61,4 @@ Contributions, issues, and feature requests are welcome! Please [open an issue](
31
61
 
32
62
  ---
33
63
 
34
- **Polytree** is developed and maintained by [@jgphilpott](https://github.com/jgphilpott).
64
+ **Polytree** is developed and maintained by [@jgphilpott](https://github.com/jgphilpott).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jgphilpott/polytree",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "A Constructive Solid Geometry (CSG) library using Octree data structure.",
5
5
  "funding": "https://github.com/sponsors/jgphilpott",
6
6
  "main": "polytree.bundle.js",
@@ -10,19 +10,25 @@
10
10
  }
11
11
  },
12
12
  "files": [
13
- "polytree.bundle.js",
13
+ "LICENSE",
14
14
  "README.md",
15
- "LICENSE"
15
+ "polytree.bundle.js",
16
+ "polytree.bundle.min.js",
17
+ "polytree.bundle.browser.js",
18
+ "polytree.bundle.browser.min.js"
16
19
  ],
17
20
  "directories": {
18
21
  "example": "examples"
19
22
  },
20
23
  "scripts": {
21
24
  "test": "jest",
22
- "pretest": "npm run compile",
25
+ "pretest": "npm run build",
23
26
  "compile": "coffee -cb .",
24
27
  "compile:watch": "coffee -cbw . &",
25
- "build": "npm run compile && cat app/polytree.js app/triangle.intersection.js > polytree.bundle.js",
28
+ "build": "npm run compile && npm run build:node && npm run build:browser && npm run minify",
29
+ "build:node": "cat app/imports.js app/polytree.js app/intersection.js app/exports.js > polytree.bundle.js",
30
+ "build:browser": "node scripts/browserify.cjs",
31
+ "minify": "uglifyjs polytree.bundle.js --compress --mangle -o polytree.bundle.min.js && uglifyjs polytree.bundle.browser.js --compress --mangle -o polytree.bundle.browser.min.js",
26
32
  "prepare": "npm run build",
27
33
  "prepublishOnly": "npm run build"
28
34
  },
@@ -36,8 +42,10 @@
36
42
  "bugs": { "url": "https://github.com/jgphilpott/polytree/issues" },
37
43
  "homepage": "https://github.com/jgphilpott/polytree#readme",
38
44
  "devDependencies": {
45
+ "browserify": "^17.0.1",
39
46
  "coffeescript": "^2.7.0",
40
- "jest": "^30.1.3"
47
+ "jest": "^30.1.3",
48
+ "uglify-js": "^3.19.3"
41
49
  },
42
50
  "dependencies": {
43
51
  "three": "^0.180.0"