bimplus-renderer 1.8.41-babel-webpack1.1 → 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/.github/instructions/es2019-webpack-compat.instructions.md +14 -0
- package/.github/instructions/jsdoc-api-docs.instructions.md +79 -0
- package/.github/instructions/moment-timezone-integration.instructions.md +37 -0
- package/.github/instructions/vitest-playwright-testing.instructions.md +99 -0
- package/package.json +3 -3
- package/JSDOC_MIGRATION_PLAN.md +0 -244
- package/MOMENT_TIMEZONE_INTEGRATION.md +0 -38
- package/MOMENT_TIMEZONE_INTEGRATION_FOR_TEST.md +0 -57
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**/webpack*.js, **/package.json, **/scripts/**/*.js"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# ES2019 Bundle Compatibility
|
|
6
|
+
|
|
7
|
+
Keep the published renderer bundle parseable by downstream Webpack 4 consumers, whose parser may stop at ES2020 syntax.
|
|
8
|
+
|
|
9
|
+
- Babel 8 `@babel/preset-env` defaults to modern browser targets. Set explicit targets below the syntax level that downstream tooling supports; for the current renderer use Chrome 79, Firefox 72, Safari 13, and Edge 79.
|
|
10
|
+
- Apply Babel to bundled dependencies that can contain newer syntax, especially `three` and `web-ifc`. Do not exclude these packages from the production Babel rule.
|
|
11
|
+
- `target: ['web', 'es2019']` and Terser's `ecma: 2019` control Webpack output and minification; neither transpiles syntax already present in input modules. Keep the Babel transform as the source-syntax compatibility step.
|
|
12
|
+
- Babel preset-env does not lower BigInt literal syntax. If a dependency introduces `1n` literals, rewrite only the literals to `BigInt("1")` calls so an ES2019 parser can read the bundle. This does not polyfill BigInt; runtime use still requires native BigInt support.
|
|
13
|
+
- Keep an Acorn check using `ecmaVersion: 2019` on the generated `dist/bimplus-renderer.js` in every production build/publish path. It should run after Webpack emits the bundle and before copying or publishing artifacts.
|
|
14
|
+
- Verify changes with the production Webpack build followed by `npm run check-es2019`. A successful Webpack/Terser build alone does not establish ES2019 compatibility.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Use when writing or updating JSDoc comments, documenting renderer API classes/methods, or generating API documentation (build-doc, build-docMd, Confluence export). Covers required tags, visibility rules, and validation."
|
|
3
|
+
applyTo: "src/**/*.js"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# JSDoc Usage for API Documentation
|
|
7
|
+
|
|
8
|
+
The public API docs are generated from JSDoc comments in `src/` via JSDoc 4 (`jsdoc.json`) with the custom plugin `scripts/jsdoc-class-ownership-plugin.js` and `scripts/generate-api-markdown.js`. Follow these rules so symbols land correctly in `documentation/Bimplus_Renderer_doc.md` and the HTML docs.
|
|
9
|
+
|
|
10
|
+
## What gets published
|
|
11
|
+
|
|
12
|
+
A symbol only appears in generated API docs when **all** of these hold:
|
|
13
|
+
|
|
14
|
+
- It has a JSDoc comment with a non-empty description.
|
|
15
|
+
- It is not marked `@private` and its name does not start with `_` (both are excluded automatically).
|
|
16
|
+
- Its kind is a container (`class`, `namespace`, `module`) or a member kind (`function`, `member`, `constant`, `event`, `typedef`, `callback`).
|
|
17
|
+
- Member symbols belong to a documented container — document the class itself, or its methods will be dropped silently.
|
|
18
|
+
|
|
19
|
+
## Required comment structure
|
|
20
|
+
|
|
21
|
+
Start with a short description, then tags in this order: visibility, structural tags, `@param`, `@returns`.
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
/**
|
|
25
|
+
* Set the dimension line visibility.
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
* @param {boolean} visible visible flag
|
|
29
|
+
* @returns {boolean} true when visibility changed
|
|
30
|
+
*/
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- Always state visibility explicitly: `@public` for API surface, `@private` for internals.
|
|
34
|
+
- `@param {Type} name description` — type in braces, lowercase primitives (`boolean`, `number`, `string`), `Object` for plain objects; document every parameter including defaults.
|
|
35
|
+
- `@returns {Type} description` whenever the method returns a value.
|
|
36
|
+
- Mark superseded API with `@deprecated` instead of deleting the comment.
|
|
37
|
+
- Name internal helpers with a leading underscore (`_getLineTexture`) — they are excluded from docs even without `@private`.
|
|
38
|
+
- The `plugins/markdown` plugin is enabled, so Markdown is allowed in descriptions.
|
|
39
|
+
|
|
40
|
+
## Class ownership — two styles
|
|
41
|
+
|
|
42
|
+
**Default-exported ES classes (preferred, new code):** the class-ownership plugin resolves `memberof`, scope, and longname automatically. Do **not** add `@memberof`, `@name`, or `@instance` to class-body methods; a description plus visibility/param/returns tags is enough. Document the class head with `@class`/`@constructor` and visibility:
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
/**
|
|
46
|
+
* Annotation class constructor.
|
|
47
|
+
*
|
|
48
|
+
* @constructor
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
class Annotation extends AnnotationBase { ... }
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Legacy function-constructor classes (e.g., `Viewport3D` in `src/viewport3d.js`):** members assigned as `this.foo = function () {}` need the full explicit tag set, otherwise JSDoc treats them as globals:
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
/**
|
|
58
|
+
* Check if renderer is in dev mode.
|
|
59
|
+
*
|
|
60
|
+
* @returns {boolean} true if renderer is in dev mode
|
|
61
|
+
* @public
|
|
62
|
+
* @function
|
|
63
|
+
* @name Viewport3D#isDevMode
|
|
64
|
+
* @memberof Viewport3D
|
|
65
|
+
* @instance
|
|
66
|
+
*/
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Use `Class#method` for instance members and `Class.method` for statics in `@name` and `{@link}` targets.
|
|
70
|
+
|
|
71
|
+
## Links
|
|
72
|
+
|
|
73
|
+
Use `{@link Class#method}` / `{@link Class.staticMethod}` for cross-references. The markdown generator fails the build on link targets without a matching anchor, so link only to documented, non-private symbols.
|
|
74
|
+
|
|
75
|
+
## Validation
|
|
76
|
+
|
|
77
|
+
- `npm run lint-doc` — fastest check; runs `jsdoc --explain` and fails on malformed comments. Run after any JSDoc change.
|
|
78
|
+
- `npm run build-docMd` — regenerates the Markdown API doc and enforces anchor/link integrity; run when adding, renaming, or removing public symbols.
|
|
79
|
+
- `npm run build-doc` (HTML), `build-docConf` (Confluence, needs Python), `build-docAll` — full outputs; only needed when publishing docs.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Use when changing moment-timezone usage, sun-position calculations, renderer dependency declarations, or their tests. Explains the test-only dependency and web-app injection requirement."
|
|
3
|
+
applyTo: "src/utils/momentTimezoneInjector.js, src/viewport3d.js, src/exports.js, test/**, package.json"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Moment-Timezone Integration
|
|
7
|
+
|
|
8
|
+
- `moment-timezone` is a renderer development dependency used by local tests. The Vitest browser setup provides it to tests through the `moment` and `MomentTZ` globals.
|
|
9
|
+
- Do not treat the renderer's development dependency or test setup as making `moment-timezone` available to consuming web applications. Keep it out of renderer production bundles unless the dependency strategy is intentionally changed.
|
|
10
|
+
- Web applications using features that require timezone data, such as `setSunPosition`, must provide `moment-timezone` themselves and inject it into the renderer with the exported `injectMomentTimezone` function before using those features.
|
|
11
|
+
- Consumers can provide the library through their own npm dependency, a CDN, or another application-managed mechanism. Existing applications that already expose a compatible `window.moment` can continue to use it.
|
|
12
|
+
- Use the exported `hasMomentTimezone` helper to check availability before injecting when needed:
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
import { injectMomentTimezone, hasMomentTimezone } from 'bimplus-renderer';
|
|
16
|
+
import moment from 'moment-timezone';
|
|
17
|
+
|
|
18
|
+
if (!hasMomentTimezone()) {
|
|
19
|
+
injectMomentTimezone(moment);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
viewport3D.setSunPosition({
|
|
23
|
+
northDirection: 0,
|
|
24
|
+
year: 2024,
|
|
25
|
+
month: 6,
|
|
26
|
+
day: 21,
|
|
27
|
+
hours: 12,
|
|
28
|
+
minutes: 0,
|
|
29
|
+
timezone: 'Europe/Berlin',
|
|
30
|
+
latitude: 52.52,
|
|
31
|
+
longitude: 13.405,
|
|
32
|
+
showSky: true
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- Preserve the runtime availability check and its clear error when required timezone support has not been provided.
|
|
37
|
+
- When changing this integration, keep the local test setup and the consuming-application injection path consistent.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Use when adding, running, or debugging renderer Vitest browser tests, modelviewer IFC DDT, Playwright image comparisons, screenshot baselines, or named report images."
|
|
3
|
+
applyTo: "**/vitest.config.mjs, **/playwright.config.mjs, **/test/**/*.js, **/modelviewer-data-driven-tests/tests/**/*.js, **/modelviewer-data-driven-tests/playwright/**/*.js, **/modelviewer-data-driven-tests/playwright/**/*.mjs, **/modelviewer-data-driven-tests/playwright/**/*.html, **/package.json"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Renderer testing: Vitest and Playwright image comparison
|
|
7
|
+
|
|
8
|
+
Run commands from the renderer directory. Follow the existing configurations
|
|
9
|
+
and helpers; do not introduce another test runner or restore Karma/Jasmine.
|
|
10
|
+
See [README testing documentation](../../README.md#unit-testing) for setup and
|
|
11
|
+
the full command reference.
|
|
12
|
+
|
|
13
|
+
## Keep the suites separate
|
|
14
|
+
|
|
15
|
+
- Use Vitest for renderer unit/performance tests and IFC geometry DDT.
|
|
16
|
+
Import test APIs from `vitest`. These tests run in real browsers using the
|
|
17
|
+
Playwright provider, not a simulated DOM.
|
|
18
|
+
- Use standalone Playwright Test for IFC image comparisons. Import its APIs
|
|
19
|
+
from `@playwright/test`; keep visual entry points as `*.spec.mjs` under
|
|
20
|
+
`modelviewer-data-driven-tests/playwright/`.
|
|
21
|
+
- Keep Node reporter regression tests as `*.test.mjs`, outside Playwright test
|
|
22
|
+
discovery. Run them with `node --test`.
|
|
23
|
+
- Keep browser execution serial to limit WebGL and model-loading memory use.
|
|
24
|
+
Do not change production rendering behavior to make a screenshot pass.
|
|
25
|
+
|
|
26
|
+
## Vitest conventions
|
|
27
|
+
|
|
28
|
+
- Reuse `test/setup/vitestBrowser.setup.js` for renderer globals, custom
|
|
29
|
+
assertions, and the per-test `#vitest-fixture`.
|
|
30
|
+
- Reuse existing viewer/viewport helpers and dispose viewers and WebGL contexts.
|
|
31
|
+
- Preserve Vite shader handling, binary IFC/OBJ imports, WASM MIME handling,
|
|
32
|
+
`/data/` fixture routes, and Polly recording compatibility.
|
|
33
|
+
- Unit/performance commands start Polly; geometry DDT commands start the
|
|
34
|
+
sibling `simple-ddt-server`. Do not conflate geometry references in
|
|
35
|
+
`Results.db` with visual PNG baselines.
|
|
36
|
+
- Keep CI recording disabled: missing Polly recordings must fail rather than
|
|
37
|
+
silently request live services.
|
|
38
|
+
|
|
39
|
+
## Visual comparison conventions
|
|
40
|
+
|
|
41
|
+
- Discover IFC files from the selected short or long dataset. Reuse the
|
|
42
|
+
viewer harness and the shared renderer Vite asset/shader configuration.
|
|
43
|
+
- Await IFC loading and camera setup before comparison. Keep diagnostic,
|
|
44
|
+
non-empty model, and WebGL context checks.
|
|
45
|
+
- Compare only `#viewport-container` using the fixed perspective view without
|
|
46
|
+
camera flight. Preserve fixed viewport/device scale and deterministic options.
|
|
47
|
+
- Use Playwright's stable screenshot comparison, not arbitrary sleeps.
|
|
48
|
+
Current settings are threshold `0.2`, zero pixels above that threshold,
|
|
49
|
+
and a 15-second screenshot timeout.
|
|
50
|
+
- Loading is covered by the separate 100-minute per-test timeout. A missing
|
|
51
|
+
snapshot is not a loading timeout; inspect the error before changing limits.
|
|
52
|
+
- Visual tests must not write geometry references to `Results.db`.
|
|
53
|
+
|
|
54
|
+
## Baseline safety
|
|
55
|
+
|
|
56
|
+
- Normal runs must not create or replace baselines automatically.
|
|
57
|
+
- Create only missing Firefox baselines with
|
|
58
|
+
`npm run test-modelviewer-ddt-visual-init` or
|
|
59
|
+
`npm run test-modelviewer-ddt-visual-long-init`.
|
|
60
|
+
- Use `-- --update-snapshots` only for an intentional, reviewed visual change;
|
|
61
|
+
never update baselines merely to hide a regression.
|
|
62
|
+
- Preserve baseline separation by browser, dataset, and OS. Generate and
|
|
63
|
+
compare on the same OS/GPU environment; review PNG changes before committing.
|
|
64
|
+
|
|
65
|
+
## Reports and filenames
|
|
66
|
+
|
|
67
|
+
- Keep HTML output in `playwright-report/`, comparison artifacts in
|
|
68
|
+
`test-results/modelviewer-visual/`, and visual JUnit output in
|
|
69
|
+
`test-results/playwright-modelviewer-visual.xml`.
|
|
70
|
+
- Keep Playwright's internal hashed files so the HTML image viewer works.
|
|
71
|
+
- The custom reporter exports only actual comparison images directly into
|
|
72
|
+
`playwright-report/data/named/`: no subfolders, `-actual` suffix, expected
|
|
73
|
+
images, diff images, or full-page failure screenshots.
|
|
74
|
+
- Use the matching expected attachment's baseline filename, including its
|
|
75
|
+
full long name. Never derive that name solely from the actual artifact:
|
|
76
|
+
Playwright may shorten it and insert a hash.
|
|
77
|
+
- The flat folder cannot distinguish identical names across browsers/retries.
|
|
78
|
+
The last result in report order wins; run one browser at a time when needed.
|
|
79
|
+
- Test naming changes against both short names and the long Allplan filename.
|
|
80
|
+
|
|
81
|
+
## Targeted validation
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
npm run test-firefox-headless
|
|
85
|
+
npm run test-chrome-headless
|
|
86
|
+
npm run test-modelviewer-ddt
|
|
87
|
+
npm run test-modelviewer-ddt-long
|
|
88
|
+
npm run test-modelviewer-ddt-visual -- --grep "BasicProject.ifc"
|
|
89
|
+
npm run test-modelviewer-ddt-visual-long -- --grep "AssemblyElement.ifc"
|
|
90
|
+
node --test modelviewer-data-driven-tests/playwright/namedImagesReporter.test.mjs
|
|
91
|
+
npm run eslint
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Select the smallest relevant suite/filter rather than running every command.
|
|
95
|
+
`npm test` runs Firefox with Istanbul coverage. Chromium visual projects are
|
|
96
|
+
available through `npx playwright test --project=chromium` and
|
|
97
|
+
`--project=chromium-long`. For comparison/reporting changes, verify a passing
|
|
98
|
+
comparison and a controlled mismatch, inspect the exact exported filenames,
|
|
99
|
+
and remove any temporary visual modification without updating baselines.
|
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
|
|
9
|
+
"version": "1.8.41",
|
|
10
10
|
"description": "bim+ renderer",
|
|
11
11
|
"types": "types/bimplus-renderer.d.ts",
|
|
12
12
|
"keywords": [
|
|
@@ -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
|
"//===================================================================================-=-=======": "",
|
|
@@ -94,7 +95,6 @@
|
|
|
94
95
|
"test-vitest-modelviewer-firefox-long-watch": "start-server-and-test ddt-long-server-task tcp:localhost:3456 test-vitest-modelviewer-firefox-watch-task",
|
|
95
96
|
"test-vitest-modelviewer-chrome-long-watch": "start-server-and-test ddt-long-server-task tcp:localhost:3456 test-vitest-modelviewer-chrome-watch-task",
|
|
96
97
|
"test-polly-listen-task": "polly listen",
|
|
97
|
-
"check-es2019": "node scripts/check-es2019.js",
|
|
98
98
|
"//===================== Test helpers to run test for one file ": "",
|
|
99
99
|
"test-one-file-chrome": "start-server-and-test test-polly-listen-task tcp:localhost:3000 \"npm run test-chrome-watch-task -- test/tests/OverlayPollyTests.js\"",
|
|
100
100
|
"test-one-file-firefox": "start-server-and-test test-polly-listen-task tcp:localhost:3000 \"npm run test-firefox-watch-task -- test/tests/OverlayPollyTests.js\"",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"file-loader": "6.2.0",
|
|
146
146
|
"globals": "17.13.0",
|
|
147
147
|
"jsdoc": "^4.0.5",
|
|
148
|
-
"moment-timezone": "^0.6.
|
|
148
|
+
"moment-timezone": "^0.6.5",
|
|
149
149
|
"object-hash": "^3.0.0",
|
|
150
150
|
"playwright": "1.64.1",
|
|
151
151
|
"raw-loader": "4.0.2",
|
package/JSDOC_MIGRATION_PLAN.md
DELETED
|
@@ -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.
|