web-documentation 1.0.39 → 1.0.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-documentation",
3
- "version": "1.0.39",
3
+ "version": "1.0.41",
4
4
  "description": "Declarative multilanguage documentation website generator",
5
5
  "keywords": [
6
6
  "documentation",
@@ -105,11 +105,11 @@
105
105
  "typescript-eslint": "^8.61.0",
106
106
  "ua-parser-js": "^2.0.10",
107
107
  "unzipper": "^0.12.3",
108
- "web-component-wrapper": "^0.0.600",
109
- "web-internationalization": "^2.0.41",
108
+ "web-component-wrapper": "^0.0.602",
109
+ "web-internationalization": "^2.0.42",
110
110
  "weboptimizer": "^3.0.24",
111
111
  "webpack-dev-server": "^5.2.5",
112
- "website-utilities": "^1.0.442"
112
+ "website-utilities": "^1.0.443"
113
113
  },
114
114
  "engines": {
115
115
  "node": ">=24",
package/source/deploy.ts CHANGED
@@ -50,14 +50,13 @@ export interface WebDocumentationConfiguration {
50
50
  tagline?: string
51
51
  trackingCode?: string
52
52
  }
53
-
54
- interface MAKE_TEMPORARY_FILE_OPTIONS {
53
+ interface MakeTemporaryFileOptions {
55
54
  directory: boolean
56
55
  encoding?: BufferEncoding | null
57
56
  extension: string
58
57
  prefix: string
59
58
  }
60
- interface SCOPE_TYPE extends Mapping<unknown> {
59
+ interface PackageConfiguration extends Mapping<unknown> {
61
60
  description?: string
62
61
  webDocumentation?: WebDocumentationConfiguration
63
62
  files?: Array<string>
@@ -105,7 +104,8 @@ const DOCUMENTATION_WEBSITE_REPOSITORY =
105
104
  // `git@github.com:thaibault/${DOCUMENTATION_WEBSITE_NAME}`
106
105
  `https://github.com/thaibault/${DOCUMENTATION_WEBSITE_NAME}.git`
107
106
  const PROJECT_PAGE_COMMIT_MESSAGE = 'Update project homepage content.'
108
- let SCOPE: SCOPE_TYPE = {name: '__dummy__', version: '1.0.0'}
107
+ let PACKAGE_CONFIGURATION: PackageConfiguration =
108
+ {name: '__dummy__', version: '1.0.0'}
109
109
  let HAS_API_DOCUMENTATION = false
110
110
  // endregion
111
111
  // region functions
@@ -116,9 +116,9 @@ let HAS_API_DOCUMENTATION = false
116
116
  * @returns Determined file path.
117
117
  */
118
118
  const makeTemporaryFile = async (
119
- givenOptions: Partial<MAKE_TEMPORARY_FILE_OPTIONS> = {}
119
+ givenOptions: Partial<MakeTemporaryFileOptions> = {}
120
120
  ): Promise<string> => {
121
- const options: MAKE_TEMPORARY_FILE_OPTIONS = {
121
+ const options: MakeTemporaryFileOptions = {
122
122
  directory: false,
123
123
  encoding: 'utf8',
124
124
  extension: '',
@@ -243,13 +243,13 @@ const generateAndPushNewDocumentationPage = async (
243
243
 
244
244
  let parameters: Mapping<unknown> = {}
245
245
  for (const [key, value] of Object.entries(
246
- SCOPE.webDocumentation || {}
246
+ PACKAGE_CONFIGURATION.webDocumentation || {}
247
247
  ))
248
248
  parameters[camelCaseToDelimited(key).toUpperCase()] = value
249
- if (!parameters.TAGLINE && SCOPE.description)
250
- parameters.TAGLINE = SCOPE.description
251
- if (!parameters.NAME && SCOPE.name)
252
- parameters.NAME = SCOPE.name
249
+ if (!parameters.TAGLINE && PACKAGE_CONFIGURATION.description)
250
+ parameters.TAGLINE = PACKAGE_CONFIGURATION.description
251
+ if (!parameters.NAME && PACKAGE_CONFIGURATION.name)
252
+ parameters.NAME = PACKAGE_CONFIGURATION.name
253
253
 
254
254
  log.debug(`Found parameters "${represent(parameters)}" to render.`)
255
255
 
@@ -278,7 +278,8 @@ const generateAndPushNewDocumentationPage = async (
278
278
 
279
279
  const serializedParameters: string =
280
280
  JSON.stringify(evaluateDynamicData(
281
- BUILD_DOCUMENTATION_PAGE_CONFIGURATION, {parameters, ...SCOPE}
281
+ BUILD_DOCUMENTATION_PAGE_CONFIGURATION,
282
+ {parameters, ...PACKAGE_CONFIGURATION}
282
283
  ))
283
284
  const parametersFilePath: string =
284
285
  await makeTemporaryFile({extension: '.json'})
@@ -286,7 +287,7 @@ const generateAndPushNewDocumentationPage = async (
286
287
 
287
288
  const evaluationResult: EvaluationResult = evaluate(
288
289
  BUILD_DOCUMENTATION_PAGE_COMMAND_TEMPLATE,
289
- {parameters, parametersFilePath, ...SCOPE}
290
+ {parameters, parametersFilePath, ...PACKAGE_CONFIGURATION}
290
291
  )
291
292
 
292
293
  if (evaluationResult.error)
@@ -343,8 +344,8 @@ const generateAndPushNewDocumentationPage = async (
343
344
  * @returns Path to build distribution bundle or "null" of building failed.
344
345
  */
345
346
  const createDistributionBundle = async (): Promise<null | string> => {
346
- if (SCOPE.scripts && SCOPE.scripts.build) {
347
- const buildCommand = `yarn ${SCOPE.scripts.build}`
347
+ if (PACKAGE_CONFIGURATION.scripts?.build) {
348
+ const buildCommand = `yarn ${PACKAGE_CONFIGURATION.scripts.build}`
348
349
  log.info(`Build distribution bundle via "${buildCommand}".`)
349
350
  log.debug(run(buildCommand))
350
351
  }
@@ -353,9 +354,9 @@ const createDistributionBundle = async (): Promise<null | string> => {
353
354
  const distributionBundleFilePath: string =
354
355
  await makeTemporaryFile({extension: '.zip'})
355
356
 
356
- const filePaths = SCOPE.files || []
357
- if (SCOPE.main)
358
- filePaths.push(SCOPE.main)
357
+ const filePaths = PACKAGE_CONFIGURATION.files || []
358
+ if (PACKAGE_CONFIGURATION.main)
359
+ filePaths.push(PACKAGE_CONFIGURATION.main)
359
360
 
360
361
  if (filePaths.length === 0)
361
362
  return null
@@ -527,10 +528,12 @@ const main = async (): Promise<void> => {
527
528
  run('git branch').includes('* main') &&
528
529
  run('git branch --all').includes('gh-pages')
529
530
  ) {
530
- SCOPE = optionalRequire(resolve('./package.json')) || SCOPE
531
+ PACKAGE_CONFIGURATION =
532
+ optionalRequire(resolve('./package.json')) ||
533
+ PACKAGE_CONFIGURATION
531
534
 
532
535
  const evaluationResult: EvaluationResult = evaluate(
533
- `\`${API_DOCUMENTATION_PATH_SUFFIX}\``, SCOPE
536
+ `\`${API_DOCUMENTATION_PATH_SUFFIX}\``, PACKAGE_CONFIGURATION
534
537
  )
535
538
 
536
539
  if (evaluationResult.error)
@@ -568,8 +571,10 @@ const main = async (): Promise<void> => {
568
571
  }
569
572
 
570
573
  HAS_API_DOCUMENTATION =
571
- Boolean(SCOPE.scripts) &&
572
- Object.prototype.hasOwnProperty.call(SCOPE.scripts, 'document')
574
+ Boolean(PACKAGE_CONFIGURATION.scripts) &&
575
+ Object.prototype.hasOwnProperty.call(
576
+ PACKAGE_CONFIGURATION.scripts, 'document'
577
+ )
573
578
  if (HAS_API_DOCUMENTATION) {
574
579
  log.info('API documentation creation script detected.')
575
580
  try {
@@ -710,8 +715,10 @@ const main = async (): Promise<void> => {
710
715
  /* eslint-disable @typescript-eslint/no-unnecessary-condition */
711
716
  RUN_FINAL_BUILD &&
712
717
  /* eslint-enable @typescript-eslint/no-unnecessary-condition */
713
- Boolean(SCOPE.scripts) &&
714
- Object.prototype.hasOwnProperty.call(SCOPE.scripts, 'build')
718
+ Boolean(PACKAGE_CONFIGURATION.scripts) &&
719
+ Object.prototype.hasOwnProperty.call(
720
+ PACKAGE_CONFIGURATION.scripts, 'build'
721
+ )
715
722
  )
716
723
  // Prepare build artifacts for further local usage.
717
724
  log.debug(run('yarn build'))
@@ -92,16 +92,16 @@ npm install clientnode
92
92
  <!--showExample:JavaScript-->
93
93
 
94
94
  ```JavaScript
95
- const domNode = clientnode.createDomNodes('<p>some content to animate</p>');
95
+ const domNode = clientnode.createDomNodes('<p>some content to animate</p>')
96
96
 
97
97
  const endless = () => {
98
98
  clientnode.fadeIn(domNode)
99
99
  .then(() => clientnode.fadeOut(domNode))
100
100
  .then(endless)
101
- };
102
- endless();
101
+ }
102
+ endless()
103
103
 
104
- document.querySelector('#first-example-playground').appendChild(domNode);
104
+ document.querySelector('#first-example-playground').appendChild(domNode)
105
105
  ```
106
106
 
107
107
  The compiled bundle supports AMD, commonjs, commonjs2 and variable injection
@@ -137,5 +137,5 @@ document.querySelector('#second-example-playground').innerText =
137
137
  operand2: {$select: 'some.data.in.scope'}
138
138
  },
139
139
  {some: {data: {in: {scope: 3}}}}
140
- );
140
+ )
141
141
  ```
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/decorator'
36
+ import {property} from 'web-component-wrapper/compatible/decorator'
37
37
  import {WebComponentAPI} from 'web-component-wrapper/type'
38
- import {Web} from 'web-component-wrapper/Web'
38
+ import {Web} from 'web-component-wrapper/compatible/Web'
39
39
  import {api as websiteUtilitiesAPI} from 'website-utilities'
40
40
  import {api as webInternationalizationAPI} from 'web-internationalization'
41
41
 
@@ -424,7 +424,15 @@ export class WebDocumentation<
424
424
  ['javascript', 'javascripts', 'js']
425
425
  .includes(match[2].toLowerCase())
426
426
  )
427
- new Function(code)()
427
+ try {
428
+ new Function(code)()
429
+ } catch (error) {
430
+ log.warn(
431
+ 'Error occurred during running ' +
432
+ `code "${code}":`,
433
+ error
434
+ )
435
+ }
428
436
  else if ([
429
437
  'css', 'cascadingstylesheet',
430
438
  'cascadingstylesheets', 'stylesheet',