Skip to content

Commit

Permalink
feat(core): add non-min and min bundle to build
Browse files Browse the repository at this point in the history
  • Loading branch information
agviegas committed Oct 17, 2024
1 parent 30288a3 commit 4dfd344
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 18 deletions.
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@thatopen/components",
"description": "Collection of core functionalities to author BIM apps.",
"version": "2.4.0-alpha.4",
"version": "2.4.0-alpha.6",
"author": "That Open Company",
"contributors": [
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
Expand Down Expand Up @@ -37,6 +37,7 @@
"access": "public"
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@thatopen/fragments": ">=2.4.0-alpha.1",
"@thatopen/ui": "~2.3.0",
"@types/three": "0.160.0",
Expand Down
55 changes: 41 additions & 14 deletions packages/core/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import dts from "vite-plugin-dts";
import { defineConfig } from "vite";
import * as path from "path";
import * as fs from "fs";
import pluginTerser from "@rollup/plugin-terser";
import * as packageJson from "./package.json";

const generateTSNamespace = (dts: Map<string, string>) => {
Expand All @@ -25,26 +26,52 @@ const generateTSNamespace = (dts: Map<string, string>) => {
export default defineConfig({
build: {
outDir: "./dist",
minify: false,
lib: {
entry: path.resolve(__dirname, "./src/index.ts"),
formats: ["es", "cjs"],
fileName: (format) => {
const map = {
cjs: "cjs",
es: "mjs",
};
return `index.${map[format]}`;
},
},
rollupOptions: {
external: Object.keys(packageJson.peerDependencies),
output: {
globals: {
three: "THREE",
"@thatopen/fragments": "FRAGS",
"web-ifc": "WEB-IFC",
output: [
{
entryFileNames: `index.mjs`,
format: "es",
globals: {
three: "THREE",
"@thatopen/fragments": "FRAGS",
"web-ifc": "WEB-IFC",
},
},
},
{
entryFileNames: `index.cjs`,
format: "cjs",
globals: {
three: "THREE",
"@thatopen/fragments": "FRAGS",
"web-ifc": "WEB-IFC",
},
},
{
entryFileNames: `index.min.mjs`,
plugins: [pluginTerser()],
format: "es",
globals: {
three: "THREE",
"@thatopen/fragments": "FRAGS",
"web-ifc": "WEB-IFC",
},
},
{
entryFileNames: `index.min.cjs`,
plugins: [pluginTerser()],
format: "cjs",
globals: {
three: "THREE",
"@thatopen/fragments": "FRAGS",
"web-ifc": "WEB-IFC",
},
},
],
},
},
plugins: [
Expand Down
154 changes: 151 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,58 @@ __metadata:
languageName: node
linkType: hard

"@jridgewell/gen-mapping@npm:^0.3.5":
version: 0.3.5
resolution: "@jridgewell/gen-mapping@npm:0.3.5"
dependencies:
"@jridgewell/set-array": ^1.2.1
"@jridgewell/sourcemap-codec": ^1.4.10
"@jridgewell/trace-mapping": ^0.3.24
checksum: ff7a1764ebd76a5e129c8890aa3e2f46045109dabde62b0b6c6a250152227647178ff2069ea234753a690d8f3c4ac8b5e7b267bbee272bffb7f3b0a370ab6e52
languageName: node
linkType: hard

"@jridgewell/resolve-uri@npm:^3.1.0":
version: 3.1.2
resolution: "@jridgewell/resolve-uri@npm:3.1.2"
checksum: 83b85f72c59d1c080b4cbec0fef84528963a1b5db34e4370fa4bd1e3ff64a0d80e0cee7369d11d73c704e0286fb2865b530acac7a871088fbe92b5edf1000870
languageName: node
linkType: hard

"@jridgewell/set-array@npm:^1.2.1":
version: 1.2.1
resolution: "@jridgewell/set-array@npm:1.2.1"
checksum: 832e513a85a588f8ed4f27d1279420d8547743cc37fcad5a5a76fc74bb895b013dfe614d0eed9cb860048e6546b798f8f2652020b4b2ba0561b05caa8c654b10
languageName: node
linkType: hard

"@jridgewell/source-map@npm:^0.3.3":
version: 0.3.6
resolution: "@jridgewell/source-map@npm:0.3.6"
dependencies:
"@jridgewell/gen-mapping": ^0.3.5
"@jridgewell/trace-mapping": ^0.3.25
checksum: c9dc7d899397df95e3c9ec287b93c0b56f8e4453cd20743e2b9c8e779b1949bc3cccf6c01bb302779e46560eb45f62ea38d19fedd25370d814734268450a9f30
languageName: node
linkType: hard

"@jridgewell/sourcemap-codec@npm:^1.4.10, @jridgewell/sourcemap-codec@npm:^1.4.14":
version: 1.5.0
resolution: "@jridgewell/sourcemap-codec@npm:1.5.0"
checksum: 05df4f2538b3b0f998ea4c1cd34574d0feba216fa5d4ccaef0187d12abf82eafe6021cec8b49f9bb4d90f2ba4582ccc581e72986a5fcf4176ae0cfeb04cf52ec
languageName: node
linkType: hard

"@jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.25":
version: 0.3.25
resolution: "@jridgewell/trace-mapping@npm:0.3.25"
dependencies:
"@jridgewell/resolve-uri": ^3.1.0
"@jridgewell/sourcemap-codec": ^1.4.14
checksum: 9d3c40d225e139987b50c48988f8717a54a8c994d8a948ee42e1412e08988761d0754d7d10b803061cc3aebf35f92a5dbbab493bd0e1a9ef9e89a2130e83ba34
languageName: node
linkType: hard

"@lit-labs/ssr-dom-shim@npm:^1.2.0":
version: 1.2.1
resolution: "@lit-labs/ssr-dom-shim@npm:1.2.1"
Expand Down Expand Up @@ -447,6 +499,22 @@ __metadata:
languageName: node
linkType: hard

"@rollup/plugin-terser@npm:^0.4.4":
version: 0.4.4
resolution: "@rollup/plugin-terser@npm:0.4.4"
dependencies:
serialize-javascript: ^6.0.1
smob: ^1.0.0
terser: ^5.17.4
peerDependencies:
rollup: ^2.0.0||^3.0.0||^4.0.0
peerDependenciesMeta:
rollup:
optional: true
checksum: 5472f659fbb7034488df91eb01ecd2ddf6d2cf203d049aa486139225ad5566254c6ec24aad1f5d1167e35f480212ede5160df9cc80e149a28874f78ed6a7fd9a
languageName: node
linkType: hard

"@rollup/pluginutils@npm:^5.1.0":
version: 5.1.2
resolution: "@rollup/pluginutils@npm:5.1.2"
Expand Down Expand Up @@ -621,7 +689,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@thatopen/components-front@workspace:packages/front"
dependencies:
"@thatopen/components": ">=2.4.0-alpha.2"
"@thatopen/components": ">=2.4.0-alpha.3"
"@thatopen/fragments": ">=2.4.0-alpha.1"
"@thatopen/ui": ~2.3.0
"@thatopen/ui-obc": ~2.3.0
Expand All @@ -641,10 +709,11 @@ __metadata:
languageName: unknown
linkType: soft

"@thatopen/components@>=2.4.0-alpha.2, @thatopen/components@workspace:packages/core":
"@thatopen/components@>=2.4.0-alpha.3, @thatopen/components@workspace:packages/core":
version: 0.0.0-use.local
resolution: "@thatopen/components@workspace:packages/core"
dependencies:
"@rollup/plugin-terser": ^0.4.4
"@thatopen/fragments": ">=2.4.0-alpha.1"
"@thatopen/ui": ~2.3.0
"@types/three": 0.160.0
Expand Down Expand Up @@ -1021,6 +1090,15 @@ __metadata:
languageName: node
linkType: hard

"acorn@npm:^8.8.2":
version: 8.13.0
resolution: "acorn@npm:8.13.0"
bin:
acorn: bin/acorn
checksum: f1541f05eb5d6ff67990d1927290809b1ebb663ac96d9c7057c935cf29c5bcaba6d39f37bd007f4bb814f162f142b0f2b2dd4b14128b8fcfaf9f0508a6f05f1c
languageName: node
linkType: hard

"acorn@npm:^8.9.0":
version: 8.12.1
resolution: "acorn@npm:8.12.1"
Expand Down Expand Up @@ -1236,6 +1314,13 @@ __metadata:
languageName: node
linkType: hard

"buffer-from@npm:^1.0.0":
version: 1.1.2
resolution: "buffer-from@npm:1.1.2"
checksum: 0448524a562b37d4d7ed9efd91685a5b77a50672c556ea254ac9a6d30e3403a517d8981f10e565db24e8339413b43c97ca2951f10e399c6125a0d8911f5679bb
languageName: node
linkType: hard

"cacache@npm:^18.0.0":
version: 18.0.4
resolution: "cacache@npm:18.0.4"
Expand Down Expand Up @@ -1332,6 +1417,13 @@ __metadata:
languageName: node
linkType: hard

"commander@npm:^2.20.0":
version: 2.20.3
resolution: "commander@npm:2.20.3"
checksum: ab8c07884e42c3a8dbc5dd9592c606176c7eb5c1ca5ff274bcf907039b2c41de3626f684ea75ccf4d361ba004bbaff1f577d5384c155f3871e456bdf27becf9e
languageName: node
linkType: hard

"commander@npm:^9.4.1":
version: 9.5.0
resolution: "commander@npm:9.5.0"
Expand Down Expand Up @@ -3535,6 +3627,15 @@ __metadata:
languageName: node
linkType: hard

"randombytes@npm:^2.1.0":
version: 2.1.0
resolution: "randombytes@npm:2.1.0"
dependencies:
safe-buffer: ^5.1.0
checksum: d779499376bd4cbb435ef3ab9a957006c8682f343f14089ed5f27764e4645114196e75b7f6abf1cbd84fd247c0cb0651698444df8c9bf30e62120fbbc52269d6
languageName: node
linkType: hard

"readable-stream@npm:~2.3.6":
version: 2.3.8
resolution: "readable-stream@npm:2.3.8"
Expand Down Expand Up @@ -3744,6 +3845,13 @@ __metadata:
languageName: node
linkType: hard

"safe-buffer@npm:^5.1.0":
version: 5.2.1
resolution: "safe-buffer@npm:5.2.1"
checksum: b99c4b41fdd67a6aaf280fcd05e9ffb0813654894223afb78a31f14a19ad220bba8aba1cb14eddce1fcfb037155fe6de4e861784eb434f7d11ed58d1e70dd491
languageName: node
linkType: hard

"safe-buffer@npm:~5.1.0, safe-buffer@npm:~5.1.1":
version: 5.1.2
resolution: "safe-buffer@npm:5.1.2"
Expand Down Expand Up @@ -3798,6 +3906,15 @@ __metadata:
languageName: node
linkType: hard

"serialize-javascript@npm:^6.0.1":
version: 6.0.2
resolution: "serialize-javascript@npm:6.0.2"
dependencies:
randombytes: ^2.1.0
checksum: c4839c6206c1d143c0f80763997a361310305751171dd95e4b57efee69b8f6edd8960a0b7fbfc45042aadff98b206d55428aee0dc276efe54f100899c7fa8ab7
languageName: node
linkType: hard

"set-function-length@npm:^1.2.1":
version: 1.2.2
resolution: "set-function-length@npm:1.2.2"
Expand Down Expand Up @@ -3880,6 +3997,13 @@ __metadata:
languageName: node
linkType: hard

"smob@npm:^1.0.0":
version: 1.5.0
resolution: "smob@npm:1.5.0"
checksum: 436b99477ace208e44bd7cd7933532958acca507320724a8e57c730accc47c5d77e538fbc554ded145f1e3411ac0c4b55f6782bceaa5839671104fd68d4bdc7f
languageName: node
linkType: hard

"socks-proxy-agent@npm:^8.0.3":
version: 8.0.4
resolution: "socks-proxy-agent@npm:8.0.4"
Expand Down Expand Up @@ -3908,7 +4032,17 @@ __metadata:
languageName: node
linkType: hard

"source-map@npm:~0.6.1":
"source-map-support@npm:~0.5.20":
version: 0.5.21
resolution: "source-map-support@npm:0.5.21"
dependencies:
buffer-from: ^1.0.0
source-map: ^0.6.0
checksum: 43e98d700d79af1d36f859bdb7318e601dfc918c7ba2e98456118ebc4c4872b327773e5a1df09b0524e9e5063bb18f0934538eace60cca2710d1fa687645d137
languageName: node
linkType: hard

"source-map@npm:^0.6.0, source-map@npm:~0.6.1":
version: 0.6.1
resolution: "source-map@npm:0.6.1"
checksum: 59ce8640cf3f3124f64ac289012c2b8bd377c238e316fb323ea22fbfe83da07d81e000071d7242cad7a23cd91c7de98e4df8830ec3f133cb6133a5f6e9f67bc2
Expand Down Expand Up @@ -4096,6 +4230,20 @@ __metadata:
languageName: node
linkType: hard

"terser@npm:^5.17.4":
version: 5.36.0
resolution: "terser@npm:5.36.0"
dependencies:
"@jridgewell/source-map": ^0.3.3
acorn: ^8.8.2
commander: ^2.20.0
source-map-support: ~0.5.20
bin:
terser: bin/terser
checksum: 489afd31901a2b170f7766948a3aa0e25da0acb41e9e35bd9f9b4751dfa2fc846e485f6fb9d34f0839a96af77f675b5fbf0a20c9aa54e0b8d7c219cf0b55e508
languageName: node
linkType: hard

"text-table@npm:^0.2.0":
version: 0.2.0
resolution: "text-table@npm:0.2.0"
Expand Down

0 comments on commit 4dfd344

Please sign in to comment.