documentation-website
Advanced tools
Comparing version 1.0.326 to 1.0.327
{ | ||
"name": "documentation-website", | ||
"version": "1.0.326", | ||
"version": "1.0.327", | ||
"description": "Declarative multilanguage documentation website generator", | ||
@@ -43,3 +43,2 @@ "keywords": [ | ||
"lint": "weboptimizer lint", | ||
"postversion": "yarn publish --non-interactive; git push --tags && git push", | ||
"prepare": "yarn build", | ||
@@ -56,51 +55,52 @@ "serve": "weboptimizer serve", | ||
"devDependencies": { | ||
"@babel/eslint-parser": "^7.23.10", | ||
"@babel/runtime": "^7.24.0", | ||
"@babel/eslint-parser": "^7.24.7", | ||
"@babel/runtime": "^7.24.7", | ||
"@types/archiver": "^6.0.2", | ||
"@types/ejs": "^3.1.5", | ||
"@types/html-minifier": "^4.0.5", | ||
"@types/jquery": "^3.5.29", | ||
"@types/jsdom": "^21.1.6", | ||
"@types/jquery": "^3.5.30", | ||
"@types/jsdom": "^21.1.7", | ||
"@types/marked": "^6.0.0", | ||
"@types/node": "^20.11.24", | ||
"@types/node": "^20.14.10", | ||
"@types/unzipper": "^0.10.9", | ||
"@typescript-eslint/eslint-plugin": "^7.1.0", | ||
"@typescript-eslint/parser": "^7.1.0", | ||
"archiver": "^7.0.0", | ||
"clientnode": "^3.0.1136", | ||
"css-loader": "^6.10.0", | ||
"cssnano": "^6.0.5", | ||
"@typescript-eslint/eslint-plugin": "^7.16.0", | ||
"@typescript-eslint/parser": "^7.16.0", | ||
"archiver": "^7.0.1", | ||
"clientnode": "^3.0.1155", | ||
"css-loader": "^7.1.2", | ||
"cssnano": "^7.0.4", | ||
"default-gateway": "^7.2.2", | ||
"errorreporter": "^1.0.304", | ||
"eslint": "^8.57.0", | ||
"eslint": "^9.6.0", | ||
"eslint-config-google": "^0.14.0", | ||
"eslint-plugin-jsdoc": "^48.2.0", | ||
"favicons": "^7.1.5", | ||
"eslint-plugin-jsdoc": "^48.5.2", | ||
"favicons": "^7.2.0", | ||
"favicons-webpack-plugin": "^6.0.1", | ||
"highlight.js": "^11.9.0", | ||
"internationalisation": "^1.0.315", | ||
"highlight.js": "^11.10.0", | ||
"internationalisation": "^1.0.317", | ||
"jest": "^29.7.0", | ||
"jquery": "^3.7.1", | ||
"jsdoc": "^4.0.2", | ||
"legal-notes": "^1.0.18", | ||
"marked": "^12.0.0", | ||
"mini-css-extract-plugin": "^2.8.1", | ||
"postcss": "^8.4.35", | ||
"jsdoc": "^4.0.3", | ||
"legal-notes": "^1.0.21", | ||
"marked": "^13.0.2", | ||
"mini-css-extract-plugin": "^2.9.0", | ||
"postcss": "^8.4.39", | ||
"postcss-fontpath": "^1.0.0", | ||
"postcss-import": "^16.0.1", | ||
"postcss-import": "^16.1.0", | ||
"postcss-loader": "^8.1.1", | ||
"postcss-mixins": "^9.0.4", | ||
"postcss-mixins": "^10.0.1", | ||
"postcss-nested": "^6.0.1", | ||
"postcss-preset-env": "^9.4.0", | ||
"postcss-preset-env": "^9.6.0", | ||
"postcss-sprites": "^4.2.1", | ||
"postcss-url": "^10.1.3", | ||
"spin.js": "^4.1.1", | ||
"style-loader": "^3.3.4", | ||
"stylelint": "^16.2.1", | ||
"stylelint-config-standard": "^36.0.0", | ||
"ua-parser-js": "^1.0.37", | ||
"unzipper": "^0.10.14", | ||
"weboptimizer": "^2.0.1452", | ||
"webpack-dev-server": "^5.0.2", | ||
"website-utilities": "^1.0.345" | ||
"style-loader": "^4.0.0", | ||
"stylelint": "^16.6.1", | ||
"stylelint-config-standard": "^36.0.1", | ||
"typescript-eslint": "^7.13.1", | ||
"ua-parser-js": "^1.0.38", | ||
"unzipper": "^0.12.1", | ||
"weboptimizer": "^2.0.1482", | ||
"webpack-dev-server": "^5.0.4", | ||
"website-utilities": "^1.0.346" | ||
}, | ||
@@ -113,3 +113,6 @@ "engines": { | ||
"resolutions": { | ||
"colors": "1.4.0" | ||
"colors": "1.4.0", | ||
"globals@npm:^14.0.0": "patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch", | ||
"globals@npm:^11.1.0": "patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch", | ||
"globals@npm:^9.18.0": "patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch" | ||
}, | ||
@@ -214,3 +217,3 @@ "sideEffects": true, | ||
"sanitizer": { | ||
"__evaluate__": "Tools.identity" | ||
"__evaluate__": "functions.identity" | ||
}, | ||
@@ -217,0 +220,0 @@ "#12": "If true, the parser does not throw any exception.", |
@@ -22,4 +22,16 @@ // #!/usr/bin/env babel-node | ||
import {execSync} from 'child_process' | ||
import Tools, {optionalRequire} from 'clientnode' | ||
import {EvaluationResult, File, Mapping, PlainObject} from 'clientnode/type' | ||
import { | ||
camelCaseToDelimited, | ||
evaluate, | ||
evaluateDynamicData, | ||
EvaluationResult, | ||
File, | ||
isDirectory, | ||
isFile, | ||
Mapping, | ||
optionalRequire, | ||
PlainObject, | ||
represent, | ||
walkDirectoryRecursively | ||
} from 'clientnode' | ||
import {createReadStream, createWriteStream} from 'fs' | ||
@@ -84,3 +96,2 @@ import { | ||
* @param stream - To Convert. | ||
* | ||
* @returns Converted buffer. | ||
@@ -105,3 +116,2 @@ */ | ||
* a ready to use api documentation. | ||
* | ||
* @returns A promise resolving when build process has finished. | ||
@@ -151,3 +161,3 @@ */ | ||
const faviconPath = 'favicon.png' | ||
if (await Tools.isFile(faviconPath)) | ||
if (await isFile(faviconPath)) | ||
await copyFile( | ||
@@ -164,3 +174,3 @@ faviconPath, | ||
)) | ||
parameters[Tools.stringCamelCaseToDelimited(key).toUpperCase()] = value | ||
parameters[camelCaseToDelimited(key).toUpperCase()] = value | ||
if (!parameters.TAGLINE && SCOPE.description) | ||
@@ -171,5 +181,3 @@ parameters.TAGLINE = SCOPE.description | ||
console.debug( | ||
`Found parameters "${Tools.represent(parameters)}" to render.` | ||
) | ||
console.debug(`Found parameters "${represent(parameters)}" to render.`) | ||
@@ -180,3 +188,3 @@ let apiDocumentationPath:null|string = null | ||
API_DOCUMENTATION_PATHS[1] + API_DOCUMENTATION_PATH_SUFFIX | ||
if (!(await Tools.isDirectory(apiDocumentationPath))) | ||
if (!(await isDirectory(apiDocumentationPath))) | ||
apiDocumentationPath = API_DOCUMENTATION_PATHS[1] | ||
@@ -190,3 +198,3 @@ } | ||
DISTRIBUTION_BUNDLE_FILE_PATH: | ||
await Tools.isFile(DISTRIBUTION_BUNDLE_FILE_PATH) ? | ||
await isFile(DISTRIBUTION_BUNDLE_FILE_PATH) ? | ||
relative('./', DISTRIBUTION_BUNDLE_FILE_PATH) : | ||
@@ -201,3 +209,3 @@ null | ||
const serializedParameters:string = | ||
JSON.stringify(Tools.evaluateDynamicData( | ||
JSON.stringify(evaluateDynamicData( | ||
BUILD_DOCUMENTATION_PAGE_CONFIGURATION, {parameters, ...SCOPE} | ||
@@ -208,3 +216,3 @@ )) | ||
BUILD_DOCUMENTATION_PAGE_COMMAND = Tools.stringEvaluate( | ||
BUILD_DOCUMENTATION_PAGE_COMMAND = evaluate( | ||
BUILD_DOCUMENTATION_PAGE_COMMAND, | ||
@@ -239,3 +247,3 @@ {parameters, parametersFilePath, ...SCOPE} | ||
) | ||
await Tools.walkDirectoryRecursively( | ||
await walkDirectoryRecursively( | ||
documentationBuildFolderPath, | ||
@@ -253,5 +261,5 @@ (file:File):Promise<false|void> => | ||
} | ||
/** | ||
* Creates a distribution bundle file as zip archiv. | ||
* @returns Path to build distribution bundle or "null" of building failed. | ||
*/ | ||
@@ -300,3 +308,3 @@ const createDistributionBundle = async ():Promise<null|string> => { | ||
if (!(await isFileIgnored(filePath))) | ||
if (await Tools.isDirectory(filePath)) | ||
if (await isDirectory(filePath)) | ||
result = result.concat(await determineFilePaths( | ||
@@ -353,3 +361,2 @@ (await readdir(filePath)).map((path:string):string => | ||
* @param filePath - File path to check. | ||
* | ||
* @returns Promise wrapping indicating boolean. | ||
@@ -360,5 +367,5 @@ */ | ||
basename(filePath, extname(filePath)) === 'dummyDocumentation' || | ||
await Tools.isDirectory(filePath) && | ||
await isDirectory(filePath) && | ||
['node_modules', 'build'].includes(basename(filePath)) || | ||
await Tools.isFile(filePath) && | ||
await isFile(filePath) && | ||
basename(filePath) === 'params.json' | ||
@@ -372,3 +379,2 @@ ) | ||
* @param file - Location to copy. | ||
* | ||
* @returns Promise resolving when finished coping. | ||
@@ -396,6 +402,6 @@ */ | ||
* output content. | ||
* | ||
* @returns Nothing. | ||
* @returns False or "null" indicating whether the readme file should be | ||
* ignored. | ||
*/ | ||
const addReadme = async (file:File):Promise<false|void> => { | ||
const addReadme = async (file:File):Promise<false|null> => { | ||
if (await isFileIgnored(file.path)) | ||
@@ -412,2 +418,4 @@ return false | ||
} | ||
return null | ||
} | ||
@@ -422,3 +430,3 @@ // endregion | ||
const evaluationResult:EvaluationResult = Tools.stringEvaluate( | ||
const evaluationResult:EvaluationResult = evaluate( | ||
`\`${API_DOCUMENTATION_PATH_SUFFIX}\``, SCOPE | ||
@@ -430,3 +438,3 @@ ) | ||
const temporaryDocumentationFolderPath = 'documentation-website' | ||
if (await Tools.isDirectory(temporaryDocumentationFolderPath)) | ||
if (await isDirectory(temporaryDocumentationFolderPath)) | ||
await rm(temporaryDocumentationFolderPath, {recursive: true}) | ||
@@ -436,3 +444,3 @@ | ||
await Tools.walkDirectoryRecursively('./', addReadme) | ||
await walkDirectoryRecursively('./', addReadme) | ||
@@ -451,4 +459,3 @@ let distributionBundleFilePath:null|string = null | ||
if ( | ||
distributionBundleFilePath && | ||
await Tools.isFile(distributionBundleFilePath) | ||
distributionBundleFilePath && await isFile(distributionBundleFilePath) | ||
) { | ||
@@ -477,6 +484,6 @@ await mkdir(DATA_PATH, {recursive: true}) | ||
resolve(API_DOCUMENTATION_PATHS[1]) | ||
if (await Tools.isDirectory(apiDocumentationDirectoryPath)) | ||
if (await isDirectory(apiDocumentationDirectoryPath)) | ||
await rm(apiDocumentationDirectoryPath, {recursive: true}) | ||
if (await Tools.isDirectory(API_DOCUMENTATION_PATHS[0])) | ||
if (await isDirectory(API_DOCUMENTATION_PATHS[0])) | ||
await rename( | ||
@@ -489,6 +496,6 @@ resolve(API_DOCUMENTATION_PATHS[0]), | ||
resolve(`../${basename(temporaryDocumentationFolderPath)}`) | ||
if (await Tools.isDirectory(localDocumentationWebsitePath)) { | ||
if (await isDirectory(localDocumentationWebsitePath)) { | ||
await mkdir(temporaryDocumentationFolderPath, {recursive: true}) | ||
await Tools.walkDirectoryRecursively( | ||
await walkDirectoryRecursively( | ||
localDocumentationWebsitePath, | ||
@@ -503,5 +510,6 @@ (file:File):Promise<false|void> => | ||
/* TODO | ||
const nodeModulesDirectoryPath:string = | ||
resolve(localDocumentationWebsitePath, 'node_modules') | ||
if (false && await Tools.isDirectory(nodeModulesDirectoryPath)) { | ||
if (await isDirectory(nodeModulesDirectoryPath)) { | ||
// NOTE: Not working caused by nested symlinks. | ||
@@ -519,3 +527,3 @@ const temporaryDocumentationNodeModulesDirectoryPath:string = | ||
NOTE: Mounting "node_modules" folder needs root privileges. | ||
*/ | ||
* / | ||
run(` | ||
@@ -530,6 +538,7 @@ cp \ | ||
} else | ||
run( | ||
'yarn --production=false', | ||
{cwd: temporaryDocumentationFolderPath} | ||
) | ||
*/ | ||
run( | ||
'yarn --production=false', | ||
{cwd: temporaryDocumentationFolderPath} | ||
) | ||
@@ -550,3 +559,3 @@ run('yarn clear', {cwd: temporaryDocumentationFolderPath}) | ||
for (const path of [apiDocumentationDirectoryPath, DATA_PATH]) | ||
if (await Tools.isDirectory(path)) | ||
if (await isDirectory(path)) | ||
await rm(path, {recursive: true}) | ||
@@ -562,7 +571,1 @@ // endregion | ||
} | ||
// region vim modline | ||
// vim: set tabstop=4 shiftwidth=4 expandtab: | ||
// vim: foldmethod=marker foldmarker=region,endregion: | ||
// endregion |
@@ -20,4 +20,3 @@ // #!/usr/bin/env babel-node | ||
// region imports | ||
import Tools, {$} from 'clientnode' | ||
import {RecursivePartial, $T} from 'clientnode/type' | ||
import {$, $T, extend, NOOP, RecursivePartial, Tools} from 'clientnode' | ||
import Internationalisation from 'internationalisation' | ||
@@ -32,41 +31,36 @@ import WebsiteUtilities from 'website-utilities' | ||
// region plugins/classes | ||
/* eslint-disable jsdoc/require-description-complete-sentence */ | ||
/** | ||
* This plugin holds all needed methods to extend a whole documentation site. | ||
* @property static:_commonOptions - Options extended by the options given to | ||
* the initializer method. | ||
* @property static:_commonOptions.onExamplesLoaded {Function} - Callback to | ||
* trigger when all example loaded. | ||
* @property static:_commonOptions.domNodeSelectorInfix {string} - Something | ||
* indicating controlled nodes. | ||
* @property static:_commonOptions.showExample {Object} - Options object to | ||
* configure code example representation. | ||
* @property static:_commonOptions.showExample.pattern {string} - Regular | ||
* expression to introduce a code example section. | ||
* @property static:_commonOptions.showExample.domNodeName {string} - Dom node | ||
* name to indicate a declarative example section. | ||
* @property static:_commonOptions.showExample.htmlWrapper {string} - HTML | ||
* example wrapper. | ||
* @property static:_commonOptions.domNode {Object} - Object with a mapping of | ||
* needed dom node descriptions to their corresponding selectors. | ||
* @property static:_commonOptions.section {Object} - Configuration object for | ||
* section switches between the main page and legal notes descriptions. | ||
* @property static:_commonOptions.section.aboutThisWebsite {Object} - | ||
* Configuration object for transitions concerning the legal notes section. | ||
* @property static:_commonOptions.section.aboutThisWebsite.fadeOutOptions | ||
* {Object} - Fade out configurations. | ||
* @property static:_commonOptions.section.aboutThisWebsite.fadeInOptions | ||
* {Object} - Fade in configurations. | ||
* @property static:_commonOptions.section.main {Object} - Configuration object | ||
* for transitions concerning the main section. | ||
* @property static:_commonOptions.section.main.fadeOutOptions {Object} - Fade | ||
* @property _commonOptions - Options extended by the options given to the | ||
* initializer method. | ||
* @property _commonOptions.onExamplesLoaded - Callback to trigger when all | ||
* example loaded. | ||
* @property _commonOptions.domNodeSelectorInfix - Something indicating | ||
* controlled nodes. | ||
* @property _commonOptions.showExample - Options object to configure code | ||
* example representation. | ||
* @property _commonOptions.showExample.pattern - Regular expression to | ||
* introduce a code example section. | ||
* @property _commonOptions.showExample.domNodeName - Dom node name to indicate | ||
* a declarative example section. | ||
* @property _commonOptions.showExample.htmlWrapper - HTML example wrapper. | ||
* @property _commonOptions.domNode - Object with a mapping of needed dom node | ||
* descriptions to their corresponding selectors. | ||
* @property _commonOptions.section - Configuration object for section switches | ||
* between the main page and legal notes descriptions. | ||
* @property _commonOptions.section.aboutThisWebsite - Configuration object for | ||
* transitions concerning the legal notes section. | ||
* @property _commonOptions.section.aboutThisWebsite.fadeOutOptions - Fade out | ||
* configurations. | ||
* @property _commonOptions.section.aboutThisWebsite.fadeInOptions - Fade in | ||
* configurations. | ||
* @property _commonOptions.section.main - Configuration object for transitions | ||
* concerning the main section. | ||
* @property _commonOptions.section.main.fadeOutOptions {Object} - Fade | ||
* out configurations. | ||
* @property static:_commonOptions.section.main.fadeInOptions {Object} - Fade | ||
* in configurations. | ||
* | ||
* @property _commonOptions.section.main.fadeInOptions {Object} - Fade in | ||
* configurations. | ||
* @property options - Finally configured given options. | ||
* | ||
* @property startUpAnimationIsComplete - Indicates whether start up animations | ||
* has been completed. | ||
* | ||
* @property _activateLanguageSupport - Indicates whether a language switcher | ||
@@ -76,3 +70,2 @@ * should be activated. | ||
export class Documentation extends WebsiteUtilities { | ||
/* eslint-enable jsdoc/require-description-complete-sentence */ | ||
static _commonOptions:DefaultOptions = { | ||
@@ -98,3 +91,3 @@ domNodes: { | ||
name: 'Documentation', | ||
onExamplesLoaded: Tools.noop, | ||
onExamplesLoaded: NOOP, | ||
section: { | ||
@@ -133,3 +126,2 @@ aboutThisWebsite: { | ||
* @param options - An options object. | ||
* | ||
* @returns Returns the current instance. | ||
@@ -147,3 +139,3 @@ */ | ||
return super.initialize(Tools.extend( | ||
return super.initialize(extend( | ||
true, {} as Options, Documentation._commonOptions, options | ||
@@ -245,4 +237,2 @@ )).then(():Documentation => { | ||
* @param event - Triggered event object. | ||
* | ||
* @returns Returns the current instance. | ||
*/ | ||
@@ -318,5 +308,3 @@ _onSwitchSection(sectionName:string, event?:Event):void { | ||
/** | ||
* Generates a table of contents overview and links them to their | ||
* headlines. | ||
* @returns Nothing. | ||
* Generates a table of contents via creating links referring to headlines. | ||
*/ | ||
@@ -375,3 +363,2 @@ _generateTableOfContentsLinks():void { | ||
* prevents line wrapping. | ||
* @returns Returns the current instance. | ||
*/ | ||
@@ -412,3 +399,2 @@ _makeCodeEllipsis():void { | ||
* @param excess - Amount of excess. | ||
* | ||
* @returns Returns the trimmed content. | ||
@@ -458,3 +444,2 @@ */ | ||
* Shows marked example codes directly in browser. | ||
* @returns Returns the current instance. | ||
*/ | ||
@@ -461,0 +446,0 @@ _showExamples():void { |
@@ -43,5 +43,1 @@ // #!/usr/bin/env babel-node | ||
}) | ||
// region vim modline | ||
// vim: set tabstop=4 shiftwidth=4 expandtab: | ||
// vim: foldmethod=marker foldmarker=region,endregion: | ||
// endregion |
@@ -19,3 +19,3 @@ // -*- coding: utf-8 -*- | ||
// region imports | ||
import {ProcedureFunction} from 'clientnode/type' | ||
import {ProcedureFunction} from 'clientnode' | ||
import { | ||
@@ -77,5 +77,1 @@ DomNodes as BaseDomNodes, Options as BaseOptions | ||
// endregion | ||
// region vim modline | ||
// vim: set tabstop=4 shiftwidth=4 expandtab: | ||
// vim: foldmethod=marker foldmarker=region,endregion: | ||
// endregion |
Sorry, the diff of this file is too big to display
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
1078933
4942
30
50
14