web-documentation 1.0.41 → 1.0.42

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.
Files changed (2) hide show
  1. package/package.json +5 -1
  2. package/source/index.ts +45 -34
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-documentation",
3
- "version": "1.0.41",
3
+ "version": "1.0.42",
4
4
  "description": "Declarative multilanguage documentation website generator",
5
5
  "keywords": [
6
6
  "documentation",
@@ -150,6 +150,10 @@
150
150
  },
151
151
  "library": false,
152
152
  "module": {
153
+ "aliases": {
154
+ "web-component-wrapper/decorator$": "web-component-wrapper/compatible/decorator",
155
+ "web-component-wrapper/Web": "web-component-wrapper/compatible/Web"
156
+ },
153
157
  "enforceDeduplication": true,
154
158
  "html": {
155
159
  "options": {
package/source/index.ts CHANGED
@@ -33,9 +33,9 @@ import {
33
33
  wrap
34
34
  } from 'clientnode'
35
35
  import {func, object} from 'clientnode/property-types'
36
- import {property} from 'web-component-wrapper/compatible/decorator'
36
+ import {property} from 'web-component-wrapper/decorator'
37
37
  import {WebComponentAPI} from 'web-component-wrapper/type'
38
- import {Web} from 'web-component-wrapper/compatible/Web'
38
+ import {Web} from 'web-component-wrapper/Web'
39
39
  import {api as websiteUtilitiesAPI} from 'website-utilities'
40
40
  import {api as webInternationalizationAPI} from 'web-internationalization'
41
41
 
@@ -417,7 +417,7 @@ export class WebDocumentation<
417
417
  code = codeDomNode.innerText
418
418
 
419
419
  try {
420
- let domNode: HTMLElement | string = ''
420
+ let domNode: HTMLElement | null = null
421
421
  let reInjectScripts = false
422
422
  if (match.length > 2 && match[2])
423
423
  if (
@@ -425,7 +425,17 @@ export class WebDocumentation<
425
425
  .includes(match[2].toLowerCase())
426
426
  )
427
427
  try {
428
+ /*
429
+ eslint-disable
430
+ @typescript-eslint/no-implied-eval,
431
+ @typescript-eslint/no-unsafe-call
432
+ */
428
433
  new Function(code)()
434
+ /*
435
+ eslint-enable
436
+ @typescript-eslint/no-implied-eval,
437
+ @typescript-eslint/no-unsafe-call
438
+ */
429
439
  } catch (error) {
430
440
  log.warn(
431
441
  'Error occurred during running ' +
@@ -459,40 +469,41 @@ export class WebDocumentation<
459
469
  reInjectScripts = true
460
470
  }
461
471
 
462
- if (domNode)
472
+ if (domNode) {
463
473
  codeDomNode.after(domNode)
464
474
 
465
- if (reInjectScripts)
466
- /*
467
- Injected script tags are not executed by
468
- default. So we need to reinject those.
469
- */
470
- for (const scriptDomNode of
471
- domNode.querySelectorAll('script')
472
- ) {
473
- const newScriptDomNode =
474
- document.createElement('script')
475
- for (const name of
476
- scriptDomNode.getAttributeNames()
477
- )
478
- newScriptDomNode.setAttribute(
479
- name,
480
- scriptDomNode.getAttribute(name) as
481
- string
475
+ if (reInjectScripts)
476
+ /*
477
+ Injected script tags are not executed by
478
+ default. So we need to reinject those.
479
+ */
480
+ for (const scriptDomNode of
481
+ domNode.querySelectorAll('script')
482
+ ) {
483
+ const newScriptDomNode =
484
+ document.createElement('script')
485
+ for (const name of
486
+ scriptDomNode.getAttributeNames()
482
487
  )
483
- newScriptDomNode.textContent =
484
- scriptDomNode.textContent
485
- const promise = new Promise((resolve) => {
486
- newScriptDomNode.addEventListener(
487
- 'load', resolve
488
- )
489
- })
490
- if (scriptDomNode.parentNode)
491
- scriptDomNode.parentNode.replaceChild(
492
- newScriptDomNode, scriptDomNode
493
- )
494
- await promise
495
- }
488
+ newScriptDomNode.setAttribute(
489
+ name,
490
+ scriptDomNode.getAttribute(name) as
491
+ string
492
+ )
493
+ newScriptDomNode.textContent =
494
+ scriptDomNode.textContent
495
+ const promise = new Promise((resolve) => {
496
+ newScriptDomNode.addEventListener(
497
+ 'load', resolve
498
+ )
499
+ })
500
+ if (scriptDomNode.parentNode)
501
+ scriptDomNode.parentNode.replaceChild(
502
+ newScriptDomNode, scriptDomNode
503
+ )
504
+ await promise
505
+ }
506
+ }
496
507
  } catch (error) {
497
508
  log.critical(
498
509
  `Error while integrating code "${code}":`,