bimplus-renderer 1.8.41-babel-webpack1.0 → 1.8.41

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
@@ -6,7 +6,7 @@
6
6
  " set there the full version string! ": "",
7
7
  " e.g.: semverRange: '1.8.20-my-tag-name-01' ": "",
8
8
  "================================================================================================-": "",
9
- "version": "1.8.41-babel-webpack1.0",
9
+ "version": "1.8.41",
10
10
  "description": "bim+ renderer",
11
11
  "types": "types/bimplus-renderer.d.ts",
12
12
  "keywords": [
@@ -30,7 +30,7 @@
30
30
  "scripts": {
31
31
  "eslint": "eslint src/**/* test/**/* modelviewer-data-driven-tests/tests/**/* modelviewer-data-driven-tests/playwright vitest.config.mjs playwright.config.mjs",
32
32
  "build": "npm run copy-wasm-node-modules && npm run build-worker-dev && npm run eslint && webpack --config webpack.dev.js && npm run copy-wasm",
33
- "build-prod": "npm run copy-wasm-node-modules && npm run build-worker-prod && npm run eslint && webpack --config webpack.prod.js && npm run copy-wasm",
33
+ "build-prod": "npm run copy-wasm-node-modules && npm run build-worker-prod && npm run eslint && webpack --config webpack.prod.js && npm run check-es2019 && npm run copy-wasm",
34
34
  "build-worker-dev": "npm run cleanup-compiled-worker && npm run build-wasm && webpack --config webpack.compile.worker.js && npm run copy-compiled-worker",
35
35
  "build-worker-prod": "npm run cleanup-compiled-worker && npm run build-wasm-prod && webpack --config webpack.compile.worker.js && npm run copy-compiled-worker",
36
36
  "pub": "npm run build-prod && npm publish",
@@ -46,7 +46,7 @@
46
46
  "build-wasm": "emcc -O3 ./src/assembly/process_partition_vertices.cpp -s EXPORT_ES6=1 -s MODULARIZE=1 -s USE_ES6_IMPORT_META=0 -s ENVIRONMENT='worker' -s SINGLE_FILE=1 -s INITIAL_MEMORY=64MB -s ALLOW_MEMORY_GROWTH=1 -s EXTRA_EXPORTED_RUNTIME_METHODS=['ccall'] -s EXPORTED_FUNCTIONS=['_process_vertices','_inplace_transform_vertices','_malloc','_free'] -o ./bin/processPartitionVertices.js",
47
47
  "build-wasm-prod": "emcc -O3 ./src/assembly/process_partition_vertices.cpp -s EXPORT_ES6=1 -s MODULARIZE=1 -s USE_ES6_IMPORT_META=0 -s ENVIRONMENT='worker' -s SINGLE_FILE=1 -s INITIAL_MEMORY=64MB -s ALLOW_MEMORY_GROWTH=1 -s EXTRA_EXPORTED_RUNTIME_METHODS=['ccall'] -s EXPORTED_FUNCTIONS=['_process_vertices','_inplace_transform_vertices','_malloc','_free'] -o ./bin/processPartitionVertices.js",
48
48
  "build-lls": "npm run copy-wasm-node-modules && npm run build-worker-dev && npm run eslint && webpack --config webpack.dev.js && npm run copy-wasm-lls",
49
- "build-prod-lls": "npm run copy-wasm-node-modules && npm run build-worker-prod && npm run eslint && webpack --config webpack.prod.js && npm run copy-wasm-lls",
49
+ "build-prod-lls": "npm run copy-wasm-node-modules && npm run build-worker-prod && npm run eslint && webpack --config webpack.prod.js && npm run check-es2019 && npm run copy-wasm-lls",
50
50
  "code-metrics": "plato -r -d metrics src",
51
51
  "copy-compiled-worker": "cpy --flat ./dist/GlbProcessorWorker.bimplus-renderer.worker.js ./src/compiledWorkers",
52
52
  "cleanup-compiled-worker": "rimraf ./src/compiledWorkers/GlbProcessorWorker.bimplus-renderer.worker.js",
@@ -58,6 +58,7 @@
58
58
  "npm-publish-branch-lls": "npm run build-prod-lls && npm run publish --tag",
59
59
  "npm-pack-lls": "npm run build-prod-lls && npm pack",
60
60
  "profile": "webpack --config webpack.prod.js --profile --json > stats.json && webpack-bundle-analyzer stats.json",
61
+ "check-es2019": "node scripts/check-es2019.js",
61
62
  "//=============================================================================================": "",
62
63
  "// 1.) JUnit TESTS Scripts starting test runs ": "",
63
64
  "//===================================================================================-=-=======": "",
@@ -134,6 +135,7 @@
134
135
  "@pollyjs/persister-rest": "^6.0.6",
135
136
  "@vitest/browser-playwright": "5.0.5",
136
137
  "@vitest/coverage-istanbul": "5.0.5",
138
+ "acorn": "8.19.0",
137
139
  "babel-loader": "^10.1.1",
138
140
  "bimplus-websdk": "^1.0.71",
139
141
  "clean-webpack-plugin": "^4.0.0",
@@ -143,7 +145,7 @@
143
145
  "file-loader": "6.2.0",
144
146
  "globals": "17.13.0",
145
147
  "jsdoc": "^4.0.5",
146
- "moment-timezone": "^0.6.4",
148
+ "moment-timezone": "^0.6.5",
147
149
  "object-hash": "^3.0.0",
148
150
  "playwright": "1.64.1",
149
151
  "raw-loader": "4.0.2",
@@ -0,0 +1,10 @@
1
+ const fs = require('fs');
2
+ const acorn = require('acorn');
3
+
4
+ const bundle = fs.readFileSync('dist/bimplus-renderer.js', 'utf8');
5
+ acorn.parse(bundle, {
6
+ ecmaVersion: 2019,
7
+ sourceType: 'module'
8
+ });
9
+
10
+ console.log('dist bundle is ES2019-compatible');
@@ -1,244 +0,0 @@
1
- # JSDoc Migration Plan
2
-
3
- ## Goal
4
-
5
- Replace the `documentation` package with JSDoc tooling while preserving the existing documentation workflows:
6
-
7
- - HTML documentation in `./documentation`
8
- - Markdown API documentation in `./documentation/Bimplus_Renderer_doc.md`
9
- - Confluence-compatible Markdown in `./documentation/Bimplus_Renderer_doc_confluence.md`
10
- - The existing `build-doc*` npm script interface
11
-
12
- The migration should also remove the vulnerable transitive `vue-template-compiler` dependency.
13
-
14
- ## Scope
15
-
16
- Files expected to change:
17
-
18
- - `package.json`
19
- - `package-lock.json`
20
- - New root-level `jsdoc.json` configuration
21
- - Existing `scripts/generate-api-markdown.js` renderer
22
- - `eslint.config.mjs` for scoped Node.js globals when linting the renderer
23
- - `README.md`
24
- - `documentation/Bimplus Renderer basics.md` as the HTML landing-page source
25
- - `documentation/convert_to_confluence_md.py`
26
- - Remove obsolete `doc_config.yml`
27
- - Generated files under `documentation/`
28
-
29
- The following should remain functionally unchanged:
30
-
31
- - JSDoc comments in `src/*.js`
32
- - Application source, build, and test configuration
33
-
34
- ## Porting This Plan to Other Projects
35
-
36
- Use this file as a migration template for each repository, not as a blind file-copy checklist. Before implementation, record the current source glob, generated output paths, existing `build-doc*` script names, Markdown heading/anchor conventions, and any downstream Confluence or publishing workflow. Preserve established output names and script interfaces when consumers depend on them; adapt paths and symbol grouping to that repository's JSDoc conventions.
37
-
38
- The reference custom renderer in [scripts/generate-api-markdown.js](scripts/generate-api-markdown.js) is the implementation model. Copy it only after checking that the other repository's doclets use compatible `kind`, `memberof`, `scope`, and `longname` values. Add project-specific filters or display rules only when required by its documented public API.
39
-
40
- ## Implementation Steps
41
-
42
- ### 1. Replace development dependencies
43
-
44
- Remove `documentation` from `devDependencies` and add:
45
-
46
- - `jsdoc` for parsing source comments and generating HTML
47
- - A repository-owned Markdown renderer using JSDoc's structured doclets
48
-
49
- Remove any old generator dependencies and install JSDoc:
50
-
51
- ```powershell
52
- npm uninstall documentation jsdoc-to-markdown
53
- npm install --save-dev jsdoc
54
- ```
55
-
56
- Do not add a third-party Markdown generator. `scripts/generate-api-markdown.js` renders JSDoc doclets directly and validates symbol anchors.
57
-
58
- Do not run `npm audit fix --force`; it may apply a breaking downgrade and does not provide a patched version of the vulnerable Vue 2 package.
59
-
60
- ### 2. Add `jsdoc.json`
61
-
62
- Create a root-level JSDoc configuration with these requirements:
63
-
64
- - Include JavaScript files under `src/`
65
- - Recurse through the source directory
66
- - Parse ES module syntax
67
- - Write HTML output to `./documentation`
68
- - Use `documentation/Bimplus Renderer basics.md` as the documentation landing-page content when supported
69
- - Enable JSDoc's Markdown plugin and recursive source discovery
70
-
71
- Proposed configuration:
72
-
73
- ```json
74
- {
75
- "source": {
76
- "include": ["src"],
77
- "includePattern": ".*\\.js$",
78
- "excludePattern": "(^|[\\\\/])node_modules[\\\\/]"
79
- },
80
- "opts": {
81
- "destination": "./documentation",
82
- "recurse": true,
83
- "readme": "./documentation/Bimplus Renderer basics.md"
84
- },
85
- "templates": {
86
- "cleverLinks": false,
87
- "monospaceLinks": true
88
- },
89
- "plugins": [
90
- "plugins/markdown"
91
- ]
92
- }
93
- ```
94
-
95
- `opts.recurse: true` includes deeper source directories than the previous shallow globs. Review the additional doclets and exclude non-public implementation modules as needed. Do not add `plugins/recurse`: it is not shipped by JSDoc 4 and makes the command fail with "Unable to find the plugin". Validate the configuration against the installed JSDoc version.
96
-
97
- ### 3. Update npm scripts
98
-
99
- Replace the current `documentation` commands with JSDoc equivalents while retaining the existing script names:
100
-
101
- ```json
102
- {
103
- "lint-doc": "jsdoc --configure jsdoc.json --explain",
104
- "build-doc": "npm run lint-doc && jsdoc --configure jsdoc.json",
105
- "build-docMd": "npm run lint-doc && node scripts/generate-api-markdown.js",
106
- "build-docConf": "npm run build-docMd && cd ./documentation && python convert_to_confluence_md.py",
107
- "build-docAll": "npm run build-doc && npm run build-docConf"
108
- }
109
- ```
110
-
111
- `scripts/generate-api-markdown.js` replaces `jsdoc2md`; do not add a third-party Markdown renderer. The renderer should:
112
-
113
- 1. Invoke the installed JSDoc CLI with `process.execPath`, the local `node_modules/jsdoc/jsdoc.js` entrypoint, `--configure jsdoc.json`, and `--explain`. Run with the repository root as `cwd`, capture stdout/stderr, and fail clearly on a non-zero exit or invalid JSON.
114
- 2. Parse the JSON doclets and include documented public classes, modules, namespaces, and supported API doclets only. Exclude undocumented, private, anonymous, and implementation-only symbols. Deduplicate repeated doclets by `longname`; group members by `memberof`; retain documented global functions.
115
- 3. Render the information present on doclets: container parameters, method signatures, descriptions, parameter tables, return values, callbacks/properties, types/defaults, deprecation/since/throws/see tags, and examples where present. Preserve the Markdown/HTML descriptions produced by JSDoc.
116
- 4. Emit both a useful API index and a section for each documented symbol. Escape values placed in code or Markdown tables without altering trusted JSDoc description markup.
117
- 5. Emit explicit `<a id="…" name="…"></a>` targets. Keep each fragment used in a Markdown link identical to an emitted ID. Normalize instance-method `#` separators to the existing `+` anchor form; preserve dots for static members/callbacks. For example, `BimExplorer#getUrl` maps to `BimExplorer+getUrl`, while `BimExplorer.this.onObjectSelected` keeps its dotted name. Handle nested names such as `BimExplorer.BimObjectProperties#load` explicitly.
118
- 6. Before writing the file, fail if a rendered API symbol has no anchor or if any generated `](#target)` link has no matching anchor ID. Create the destination directory if needed and write UTF-8.
119
-
120
- The checks in the renderer protect the source Markdown structure. They do not replace rendering the Markdown and testing real click navigation in the target preview/browser.
121
-
122
- The `lint-doc` command should be tested with the installed JSDoc CLI. Existing `@private` tags with values warn under JSDoc; do not use `--pedantic` unless those source comments are corrected. `--explain` emits a large doclet JSON report; suppress or capture that output in automated logs if it becomes unwieldy, while preserving the command's exit status.
123
-
124
- ### 4. Regenerate documentation
125
-
126
- Run the formats individually first:
127
-
128
- ```powershell
129
- npm run lint-doc
130
- npm run build-doc
131
- npm run build-docMd
132
- npm run build-docConf
133
- ```
134
-
135
- Then run the complete workflow:
136
-
137
- ```powershell
138
- npm run build-docAll
139
- ```
140
-
141
- The Confluence converter should continue reading `Bimplus_Renderer_doc.md` from `documentation/` and writing `Bimplus_Renderer_doc_confluence.md`. It must:
142
-
143
- - Read and write UTF-8 explicitly so Unicode output works on Windows.
144
- - Rewrite links case-insensitively when JSDoc preserves case in fragments.
145
- - When rewriting a target to `RendererApidescription-{fragment}`, emit a matching `<a id="RendererApidescription-{fragment}" name="RendererApidescription-{fragment}"></a>` alias. Rewriting links without creating matching targets leaves the converted document's links dead.
146
- - Validate every converted internal Markdown link against an emitted ID before writing the final Confluence file.
147
-
148
- Keep the raw Markdown IDs and Confluence aliases separate: the raw file uses the API fragments; only the Confluence variant uses the required `RendererApidescription-` prefix.
149
-
150
- ### 5. Review generated output
151
-
152
- Check the following:
153
-
154
- - `documentation/index.html` opens successfully
155
- - HTML assets load without missing-file errors
156
- - All documented public classes, modules, namespaces, methods, callbacks, parameters, and return values are represented
157
- - Every rendered API symbol has a generated Markdown anchor, and internal Markdown links resolve
158
- - Markdown headings and links are readable
159
- - Confluence anchors contain the expected `RendererApidescription-` prefix
160
- - Confluence-prefixed links have matching prefixed target IDs
161
- - No stale files from the previous generator remain in the generated output
162
-
163
- Do not treat matching fragment strings in source files as proof of working links. Render both Markdown files with the parser/preview used by their consumers, inspect the resulting `href` and `id` values, and click representative links: a class/module, an instance method containing `+`, a dotted member, and a nested method. If the consumer is VS Code Markdown Preview, test there; if the Confluence Markdown is pasted into Confluence, verify links in Confluence's preview/page because its anchor generation rules differ from local Markdown renderers.
164
-
165
- JSDoc will produce a different HTML structure and may use different anchor names than documentation.js. This is expected, but no public API should disappear.
166
-
167
- ### 6. Update repository guidance
168
-
169
- Update `README.md` to describe:
170
-
171
- - `jsdoc.json`
172
- - `jsdoc` and the repository-owned Markdown renderer
173
- - The revised npm scripts
174
- - The new HTML output structure
175
- - The continued Markdown-to-Confluence conversion
176
- - The fact that generated output must be regenerated after source JSDoc changes
177
- - The repository-owned Markdown renderer and its symbol/link validation
178
- - The distinction between raw Markdown IDs and Confluence-prefixed alias IDs
179
-
180
- ### 7. Remove obsolete dependency output
181
-
182
- After a successful install, verify that the old packages are gone:
183
-
184
- ```powershell
185
- npm ls documentation jsdoc-to-markdown vue-template-compiler
186
- ```
187
-
188
- The command should report that none of these packages is installed, or that they are not found in the dependency tree. Search scripts, READMEs, and the lockfile for stale `jsdoc2md`/`jsdoc-to-markdown` references; the removal-check command in this plan may name the package intentionally.
189
-
190
- Review `package-lock.json` for removal of the obsolete dependency chain. Do not remove unrelated lockfile changes produced by the package manager.
191
-
192
- ## Verification Checklist
193
-
194
- Run the documentation workflow and existing project checks:
195
-
196
- ```powershell
197
- npm install
198
- npm run lint-doc
199
- npm run build-docAll
200
- npm run build
201
- npm test
202
- npm audit
203
- ```
204
-
205
- Also lint the renderer directly if the repository ESLint script does not include it:
206
-
207
- ```powershell
208
- npx eslint scripts/generate-api-markdown.js
209
- ```
210
-
211
- Expected results:
212
-
213
- - Documentation commands complete successfully
214
- - Generated HTML, Markdown, and Confluence files exist
215
- - The application build remains successful
216
- - Existing tests remain successful
217
- - The `vue-template-compiler` audit finding is no longer introduced by this documentation toolchain
218
- - `jsdoc-to-markdown` is absent from the manifest, lockfile dependency tree, and generation scripts
219
- - Rendered raw Markdown and Confluence Markdown links navigate to their intended targets in their actual consumers
220
-
221
- `npm audit` may still report unrelated vulnerabilities. Record those separately instead of applying a forced dependency downgrade.
222
-
223
- ## Rollback
224
-
225
- If the generated output loses API content or the Confluence conversion cannot be adapted safely:
226
-
227
- 1. Restore the previous `package.json` and `package-lock.json` documentation dependencies.
228
- 2. Remove `jsdoc.json` and restore `scripts/generate-api-markdown.js` to its pre-migration contents if rollback is required.
229
- 3. Restore the previous generated `documentation/` output.
230
- 4. Reassess the JSDoc configuration and renderer before retrying.
231
-
232
- Do not modify application source code as part of rollback.
233
-
234
- ## Acceptance Criteria
235
-
236
- The migration is complete when:
237
-
238
- - `documentation` is no longer a development dependency
239
- - JSDoc generates readable HTML from the reviewed JavaScript files under `src/`
240
- - The repository-owned renderer generates the API Markdown file
241
- - The existing Confluence conversion succeeds
242
- - `build-doc`, `build-docMd`, `build-docConf`, and `build-docAll` all work
243
- - Generated documentation is reviewed and committed
244
- - Application build and tests remain unaffected
@@ -1,38 +0,0 @@
1
- # Moment Timezone Integration
2
-
3
- The `setSunPosition` function now supports optional moment-timezone integration. Here are the different ways to use it:
4
-
5
- ## Inject programmatically
6
-
7
- ```javascript
8
- import { injectMomentTimezone, hasMomentTimezone } from 'bimplus-renderer';
9
-
10
- // If you have moment-timezone available in your application
11
- import moment from 'moment-timezone';
12
-
13
- // You can check if moment-timezone is available before calling the function:
14
- if (!hasMomentTimezone()) {
15
- console.log('Injecting moment-timezone for sun positioning features');
16
- injectMomentTimezone(moment);
17
- }
18
-
19
- // Now you can use setSunPosition
20
- viewport3D.setSunPosition({
21
- northDirection: 0,
22
- year: 2024,
23
- month: 6,
24
- day: 21,
25
- hours: 12,
26
- minutes: 0,
27
- timezone: 'Europe/Berlin',
28
- latitude: 52.5200,
29
- longitude: 13.4050,
30
- showSky: true
31
- });
32
- ```
33
-
34
- This approach allows:
35
- - Backward compatibility for existing users who have moment-timezone
36
- - Forward compatibility for new users who don't want the dependency
37
- - Clear error messages when the functionality is used without the required library
38
- - Flexibility in how the library is provided (npm, CDN, injection)
@@ -1,57 +0,0 @@
1
- # Test-Only Moment-Timezone Integration
2
-
3
- ## Overview
4
-
5
- This solution successfully implements moment-timezone dependency injection specifically for tests while keeping the production code completely free of the dependency.
6
-
7
- ## Implementation
8
-
9
- ### 1. Production Code (Optional Dependency)
10
- - **[src/viewport3d.js](src/viewport3d.js)**: Contains optional moment-timezone detection
11
- - **[src/utils/momentTimezoneInjector.js](src/utils/momentTimezoneInjector.js)**: Utility for external injection (for BimExplorer app)
12
- - Production builds work without moment-timezone installed
13
- - Runtime errors provide clear instructions when moment-timezone features are needed
14
-
15
- ### 2. Test-Only Injection
16
- - **[test/setup/momentTimezoneInjector.js](test/setup/momentTimezoneInjector.js)**: Test setup that injects moment-timezone globally
17
- - **package.json**: moment-timezone installed as `devDependency` only
18
- - **[test/setup/vitestBrowser.setup.js](test/setup/vitestBrowser.setup.js)**: Imports and injects moment-timezone before test modules
19
-
20
- ### 3. Test Configuration
21
- ```javascript
22
- // In test/setup/vitestBrowser.setup.js
23
- import momentTimezone from 'moment-timezone';
24
- globalThis.MomentTZ = globalThis.moment = momentTimezone;
25
- ```
26
-
27
- ## How It Works
28
-
29
- ### For Tests
30
- 1. Vitest loads the browser setup before test modules
31
- 2. The setup imports moment-timezone (available as a dev dependency)
32
- 3. Injects it into global scope (`window.moment`)
33
- 4. All tests run with moment-timezone available
34
- 5. Sun calculation tests pass with accurate timezone handling
35
-
36
- ### For Production
37
- 1. Production code uses optional detection: `getMomentTZ()`
38
- 2. If moment-timezone isn't found, production code either:
39
- - Throws descriptive error for features requiring it (`setSunPosition`)
40
- 3. Build process excludes moment-timezone from production bundle
41
- 4. Users can inject moment-timezone via BimExplorer app if needed
42
-
43
- ## File Changes
44
-
45
- ### New Files
46
- - `test/setup/momentTimezoneInjector.js` - Test environment setup
47
-
48
- ### Modified Files
49
- - `test/setup/vitestBrowser.setup.js` - Imports and injects moment-timezone before test modules
50
- - `package.json` - Added moment-timezone as devDependency
51
-
52
- ### Existing Files (Unchanged)
53
- - `src/viewport3d.js` - Already has optional moment-timezone detection
54
- - `src/utils/momentTimezoneInjector.js` - Already provides injection utilities
55
- - All test files - Work seamlessly with injected moment-timezone
56
-
57
- This solution provides the best of both worlds: comprehensive test coverage with accurate timezone calculations, while maintaining a lean production build without unnecessary dependencies.