@design-edito/cli 0.0.66 → 0.0.70
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/cli/assets/version.txt +1 -1
- package/make-template/assets/express/gitignore +214 -0
- package/make-template/assets/express/package.json +29 -0
- package/make-template/assets/express/scripts/build/index.ts +0 -0
- package/make-template/assets/express/scripts/tsconfig.json +108 -0
- package/make-template/assets/express/src/app.ts +16 -0
- package/make-template/assets/express/src/bin/start.ts +49 -0
- package/make-template/assets/express/src/routes/index.ts +7 -0
- package/make-template/assets/express/src/tsconfig.json +11 -0
- package/make-template/index.js +3 -2
- package/make-template/index.js.map +3 -3
- package/package.json +8 -8
- package/tree/index.js +1 -1
- package/tree/index.js.map +3 -3
package/cli/assets/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.70
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# Created by https://www.toptal.com/developers/gitignore/api/node,osx,linux,windows
|
|
2
|
+
# Edit at https://www.toptal.com/developers/gitignore?templates=node,osx,linux,windows
|
|
3
|
+
|
|
4
|
+
### Linux ###
|
|
5
|
+
*~
|
|
6
|
+
|
|
7
|
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
|
8
|
+
.fuse_hidden*
|
|
9
|
+
|
|
10
|
+
# KDE directory preferences
|
|
11
|
+
.directory
|
|
12
|
+
|
|
13
|
+
# Linux trash folder which might appear on any partition or disk
|
|
14
|
+
.Trash-*
|
|
15
|
+
|
|
16
|
+
# .nfs files are created when an open file is removed but is still being accessed
|
|
17
|
+
.nfs*
|
|
18
|
+
|
|
19
|
+
### Node ###
|
|
20
|
+
# Logs
|
|
21
|
+
logs
|
|
22
|
+
*.log
|
|
23
|
+
npm-debug.log*
|
|
24
|
+
yarn-debug.log*
|
|
25
|
+
yarn-error.log*
|
|
26
|
+
lerna-debug.log*
|
|
27
|
+
.pnpm-debug.log*
|
|
28
|
+
|
|
29
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
30
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
31
|
+
|
|
32
|
+
# Runtime data
|
|
33
|
+
pids
|
|
34
|
+
*.pid
|
|
35
|
+
*.seed
|
|
36
|
+
*.pid.lock
|
|
37
|
+
|
|
38
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
39
|
+
lib-cov
|
|
40
|
+
|
|
41
|
+
# Coverage directory used by tools like istanbul
|
|
42
|
+
coverage
|
|
43
|
+
*.lcov
|
|
44
|
+
|
|
45
|
+
# nyc test coverage
|
|
46
|
+
.nyc_output
|
|
47
|
+
|
|
48
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
49
|
+
.grunt
|
|
50
|
+
|
|
51
|
+
# Bower dependency directory (https://bower.io/)
|
|
52
|
+
bower_components
|
|
53
|
+
|
|
54
|
+
# node-waf configuration
|
|
55
|
+
.lock-wscript
|
|
56
|
+
|
|
57
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
58
|
+
build/Release
|
|
59
|
+
|
|
60
|
+
# Dependency directories
|
|
61
|
+
node_modules/
|
|
62
|
+
jspm_packages/
|
|
63
|
+
|
|
64
|
+
# Snowpack dependency directory (https://snowpack.dev/)
|
|
65
|
+
web_modules/
|
|
66
|
+
|
|
67
|
+
# TypeScript cache
|
|
68
|
+
*.tsbuildinfo
|
|
69
|
+
|
|
70
|
+
# Optional npm cache directory
|
|
71
|
+
.npm
|
|
72
|
+
|
|
73
|
+
# Optional eslint cache
|
|
74
|
+
.eslintcache
|
|
75
|
+
|
|
76
|
+
# Optional stylelint cache
|
|
77
|
+
.stylelintcache
|
|
78
|
+
|
|
79
|
+
# Microbundle cache
|
|
80
|
+
.rpt2_cache/
|
|
81
|
+
.rts2_cache_cjs/
|
|
82
|
+
.rts2_cache_es/
|
|
83
|
+
.rts2_cache_umd/
|
|
84
|
+
|
|
85
|
+
# Optional REPL history
|
|
86
|
+
.node_repl_history
|
|
87
|
+
|
|
88
|
+
# Output of 'npm pack'
|
|
89
|
+
*.tgz
|
|
90
|
+
|
|
91
|
+
# Yarn Integrity file
|
|
92
|
+
.yarn-integrity
|
|
93
|
+
|
|
94
|
+
# dotenv environment variable files
|
|
95
|
+
.env
|
|
96
|
+
.env.development.local
|
|
97
|
+
.env.test.local
|
|
98
|
+
.env.production.local
|
|
99
|
+
.env.local
|
|
100
|
+
|
|
101
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
102
|
+
.cache
|
|
103
|
+
.parcel-cache
|
|
104
|
+
|
|
105
|
+
# Next.js build output
|
|
106
|
+
.next
|
|
107
|
+
out
|
|
108
|
+
|
|
109
|
+
# Nuxt.js build / generate output
|
|
110
|
+
.nuxt
|
|
111
|
+
dist
|
|
112
|
+
|
|
113
|
+
# Gatsby files
|
|
114
|
+
.cache/
|
|
115
|
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
116
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
117
|
+
# public
|
|
118
|
+
|
|
119
|
+
# vuepress build output
|
|
120
|
+
.vuepress/dist
|
|
121
|
+
|
|
122
|
+
# vuepress v2.x temp and cache directory
|
|
123
|
+
.temp
|
|
124
|
+
|
|
125
|
+
# Docusaurus cache and generated files
|
|
126
|
+
.docusaurus
|
|
127
|
+
|
|
128
|
+
# Serverless directories
|
|
129
|
+
.serverless/
|
|
130
|
+
|
|
131
|
+
# FuseBox cache
|
|
132
|
+
.fusebox/
|
|
133
|
+
|
|
134
|
+
# DynamoDB Local files
|
|
135
|
+
.dynamodb/
|
|
136
|
+
|
|
137
|
+
# TernJS port file
|
|
138
|
+
.tern-port
|
|
139
|
+
|
|
140
|
+
# Stores VSCode versions used for testing VSCode extensions
|
|
141
|
+
.vscode-test
|
|
142
|
+
|
|
143
|
+
# yarn v2
|
|
144
|
+
.yarn/cache
|
|
145
|
+
.yarn/unplugged
|
|
146
|
+
.yarn/build-state.yml
|
|
147
|
+
.yarn/install-state.gz
|
|
148
|
+
.pnp.*
|
|
149
|
+
|
|
150
|
+
### Node Patch ###
|
|
151
|
+
# Serverless Webpack directories
|
|
152
|
+
.webpack/
|
|
153
|
+
|
|
154
|
+
# Optional stylelint cache
|
|
155
|
+
|
|
156
|
+
# SvelteKit build / generate output
|
|
157
|
+
.svelte-kit
|
|
158
|
+
|
|
159
|
+
### OSX ###
|
|
160
|
+
# General
|
|
161
|
+
.DS_Store
|
|
162
|
+
.AppleDouble
|
|
163
|
+
.LSOverride
|
|
164
|
+
|
|
165
|
+
# Icon must end with two \r
|
|
166
|
+
Icon
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
# Thumbnails
|
|
170
|
+
._*
|
|
171
|
+
|
|
172
|
+
# Files that might appear in the root of a volume
|
|
173
|
+
.DocumentRevisions-V100
|
|
174
|
+
.fseventsd
|
|
175
|
+
.Spotlight-V100
|
|
176
|
+
.TemporaryItems
|
|
177
|
+
.Trashes
|
|
178
|
+
.VolumeIcon.icns
|
|
179
|
+
.com.apple.timemachine.donotpresent
|
|
180
|
+
|
|
181
|
+
# Directories potentially created on remote AFP share
|
|
182
|
+
.AppleDB
|
|
183
|
+
.AppleDesktop
|
|
184
|
+
Network Trash Folder
|
|
185
|
+
Temporary Items
|
|
186
|
+
.apdisk
|
|
187
|
+
|
|
188
|
+
### Windows ###
|
|
189
|
+
# Windows thumbnail cache files
|
|
190
|
+
Thumbs.db
|
|
191
|
+
Thumbs.db:encryptable
|
|
192
|
+
ehthumbs.db
|
|
193
|
+
ehthumbs_vista.db
|
|
194
|
+
|
|
195
|
+
# Dump file
|
|
196
|
+
*.stackdump
|
|
197
|
+
|
|
198
|
+
# Folder config file
|
|
199
|
+
[Dd]esktop.ini
|
|
200
|
+
|
|
201
|
+
# Recycle Bin used on file shares
|
|
202
|
+
$RECYCLE.BIN/
|
|
203
|
+
|
|
204
|
+
# Windows Installer files
|
|
205
|
+
*.cab
|
|
206
|
+
*.msi
|
|
207
|
+
*.msix
|
|
208
|
+
*.msm
|
|
209
|
+
*.msp
|
|
210
|
+
|
|
211
|
+
# Windows shortcuts
|
|
212
|
+
*.lnk
|
|
213
|
+
|
|
214
|
+
# End of https://www.toptal.com/developers/gitignore/api/node,osx,linux,windows
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lm-publisher",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build:src": "npx esbuild --bundle src/bin/start.ts --outdir=dist --minify --sourcemap --platform=node",
|
|
7
|
+
"watch:src": "npm run build:src && npx chokidar 'src/**/*' -c 'npm run build:src'",
|
|
8
|
+
"serve": "npx nodemon ./dist/start.js",
|
|
9
|
+
"start:nowatch": "npm run build:src && npm run serve",
|
|
10
|
+
"start": "npx concurrently -n 'watch:src ,serve ' 'npm run watch:src' 'npm run serve'"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"cookie-parser": "~1.4.4",
|
|
14
|
+
"debug": "~2.6.9",
|
|
15
|
+
"express": "^4.19.2",
|
|
16
|
+
"morgan": "~1.9.1"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/cookie-parser": "^1.4.7",
|
|
20
|
+
"@types/debug": "^4.1.12",
|
|
21
|
+
"@types/express": "^4.17.21",
|
|
22
|
+
"@types/morgan": "^1.9.9",
|
|
23
|
+
"@types/node": "^22.2.0",
|
|
24
|
+
"chokidar-cli": "^3.0.0",
|
|
25
|
+
"concurrently": "^8.2.2",
|
|
26
|
+
"esbuild": "^0.23.0",
|
|
27
|
+
"typescript": "^5.5.4"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
+
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
+
|
|
27
|
+
/* Modules */
|
|
28
|
+
"module": "commonjs", /* Specify what module code is generated. */
|
|
29
|
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
30
|
+
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
+
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
|
+
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
|
+
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
39
|
+
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
40
|
+
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
41
|
+
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
42
|
+
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
43
|
+
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
44
|
+
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
45
|
+
|
|
46
|
+
/* JavaScript Support */
|
|
47
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
48
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
49
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
50
|
+
|
|
51
|
+
/* Emit */
|
|
52
|
+
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
53
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
54
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
55
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
56
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
57
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
58
|
+
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
|
59
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
60
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
61
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
62
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
63
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
64
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
65
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
66
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
67
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
68
|
+
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
69
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
70
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
71
|
+
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
72
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
73
|
+
|
|
74
|
+
/* Interop Constraints */
|
|
75
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
76
|
+
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
77
|
+
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
|
78
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
79
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
80
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
81
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
82
|
+
|
|
83
|
+
/* Type Checking */
|
|
84
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
85
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
86
|
+
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
87
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
88
|
+
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
89
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
90
|
+
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
91
|
+
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
92
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
93
|
+
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
94
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
95
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
96
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
97
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
98
|
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
99
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
100
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
101
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
102
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
103
|
+
|
|
104
|
+
/* Completeness */
|
|
105
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
106
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import express from 'express'
|
|
3
|
+
import cookieParser from 'cookie-parser'
|
|
4
|
+
import logger from 'morgan'
|
|
5
|
+
import indexRouter from './routes/index'
|
|
6
|
+
|
|
7
|
+
const app = express()
|
|
8
|
+
|
|
9
|
+
app.use(logger('dev'))
|
|
10
|
+
app.use(express.json())
|
|
11
|
+
app.use(express.urlencoded({ extended: false }))
|
|
12
|
+
app.use(cookieParser())
|
|
13
|
+
app.use(express.static(path.join(__dirname, 'public')))
|
|
14
|
+
app.use('/', indexRouter)
|
|
15
|
+
|
|
16
|
+
export default app
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import http from 'node:http'
|
|
2
|
+
import debugModule from 'debug'
|
|
3
|
+
import app from '../app'
|
|
4
|
+
|
|
5
|
+
const debug = debugModule('<<@mxfb/cli----replace-with-name>>:server')
|
|
6
|
+
const port = normalizePort(process.env.PORT ?? '3000')
|
|
7
|
+
|
|
8
|
+
app.set('port', port)
|
|
9
|
+
|
|
10
|
+
const server = http.createServer(app)
|
|
11
|
+
|
|
12
|
+
server.listen(port)
|
|
13
|
+
server.on('error', onError)
|
|
14
|
+
server.on('listening', onListening)
|
|
15
|
+
|
|
16
|
+
function normalizePort (val: string) {
|
|
17
|
+
var port = parseInt(val, 10)
|
|
18
|
+
if (isNaN(port)) return val
|
|
19
|
+
if (port >= 0) return port
|
|
20
|
+
return false
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface NodeError extends Error {
|
|
24
|
+
syscall?: string
|
|
25
|
+
code?: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function onError (error: NodeError) {
|
|
29
|
+
if (error.syscall !== 'listen') throw error
|
|
30
|
+
var bind = typeof port === 'string' ? 'Pipe ' + port : 'Port ' + port
|
|
31
|
+
switch (error.code) {
|
|
32
|
+
case 'EACCES':
|
|
33
|
+
console.error(bind + ' requires elevated privileges')
|
|
34
|
+
process.exit(1)
|
|
35
|
+
break
|
|
36
|
+
case 'EADDRINUSE':
|
|
37
|
+
console.error(bind + ' is already in use')
|
|
38
|
+
process.exit(1)
|
|
39
|
+
break
|
|
40
|
+
default:
|
|
41
|
+
throw error
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function onListening () {
|
|
46
|
+
var addr = server.address()
|
|
47
|
+
var bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + (addr?.port ?? '')
|
|
48
|
+
debug('Listening on ' + bind)
|
|
49
|
+
}
|
package/make-template/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
`},{encoding:"utf-8"});let
|
|
2
|
+
import l from"node:process";import{promises as i,existsSync as j}from"node:fs";import x from"node:url";import t from"node:path";import{spawn as w}from"node:child_process";import{program as d}from"commander";import y from"prompts";import{Files as f}from"@design-edito/tools/node/files/index.js";var k=x.fileURLToPath(import.meta.url),h=t.dirname(k),p=l.cwd();d.name("@design-edito/make-template").description("Generate in cwd a project template");d.command("express").description("make express.js + typescript project structure").action(N);d.command("html").description("make simple html project structure").action(S);d.command("react").description("make react + typescript project structure").action(b);d.parse(l.argv);async function S(){let o=t.join(h,"assets/html");if(!j(o))return console.error(`Could not find the template to copy at ${o}`),l.exit(1);let n=t.join(p,"html-template");await i.cp(o,n,{recursive:!0})}async function b(){let o=t.join(h,"assets/react");if(!j(o))return console.error(`Could not find the template to copy at ${o}`),l.exit(1);let n=t.join(p,"react-template");await i.cp(o,n,{recursive:!0});let{projectName:s}=await y({name:"projectName",message:"Project name ? (for package.json name field)",type:"text"}),u=t.join(n,"package.json");await f.readWrite(u,r=>{let e=typeof r=="string"?r:r.toString(),a=JSON.parse(e);delete a.name;let m={name:s,...a};return`${JSON.stringify(m,null,2)}
|
|
3
|
+
`},{encoding:"utf-8"});let g=w(`cd ${n} && npm i`,{stdio:"inherit",shell:!0});await new Promise((r,e)=>{g.on("exit",()=>r(!0)),g.on("error",()=>e(!1))});let c=t.join(p,s);await i.rename(n,c),await i.rename(t.join(c,"gitignore"),t.join(c,".gitignore"))}async function N(){let o=t.join(h,"assets/express");if(!j(o))return console.error(`Could not find the template to copy at ${o}`),l.exit(1);let n=t.join(p,"express-template");await i.cp(o,n,{recursive:!0});let{projectName:s}=await y({name:"projectName",message:"Project name ? (for package.json name field)",type:"text"}),u=t.join(n,"package.json");await f.readWrite(u,e=>{let a=typeof e=="string"?e:e.toString(),m=JSON.parse(a);delete m.name;let P={name:s,...m};return`${JSON.stringify(P,null,2)}
|
|
4
|
+
`},{encoding:"utf-8"});let g=t.join(n,"src/bin/start.ts");await f.readWrite(g,e=>(typeof e=="string"?e:e.toString()).replace("<<@mxfb/cli----replace-with-name>>",s),{encoding:"utf-8"});let c=w(`cd ${n} && npm i`,{stdio:"inherit",shell:!0});await new Promise((e,a)=>{c.on("exit",()=>e(!0)),c.on("error",()=>a(!1))});let r=t.join(p,s);await i.rename(n,r),await i.rename(t.join(r,"gitignore"),t.join(r,".gitignore"))}
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/make-template/index.ts"],
|
|
4
|
-
"sourcesContent": ["import process from 'node:process'\nimport { promises as fs, existsSync } from 'node:fs'\nimport url from 'node:url'\nimport path from 'node:path'\nimport { spawn } from 'node:child_process'\nimport { program } from 'commander'\nimport prompts from 'prompts'\nimport
|
|
5
|
-
"mappings": "AAAA,OAAOA,MAAa,eACpB,OAAS,YAAYC,EAAI,cAAAC,MAAkB,UAC3C,OAAOC,MAAS,WAChB,OAAOC,MAAU,YACjB,OAAS,SAAAC,MAAa,qBACtB,OAAS,WAAAC,MAAe,YACxB,OAAOC,MAAa,UACpB,
|
|
6
|
-
"names": ["process", "fs", "existsSync", "url", "path", "spawn", "program", "prompts", "
|
|
4
|
+
"sourcesContent": ["import process from 'node:process'\nimport { promises as fs, existsSync } from 'node:fs'\nimport url from 'node:url'\nimport path from 'node:path'\nimport { spawn } from 'node:child_process'\nimport { program } from 'commander'\nimport prompts from 'prompts'\nimport { Files } from '@design-edito/tools/node/files/index.js'\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\nconst CWD = process.cwd()\n\nprogram\n .name('@design-edito/make-template')\n .description('Generate in cwd a project template')\n\nprogram\n .command('express')\n .description('make express.js + typescript project structure')\n .action(makeExpress)\n \nprogram\n .command('html')\n .description('make simple html project structure')\n .action(makeHtml)\n\nprogram\n .command('react')\n .description('make react + typescript project structure')\n .action(makeReact)\n\nprogram.parse(process.argv)\n\nasync function makeHtml () {\n const htmlTemplatePath = path.join(__dirname, 'assets/html')\n if (!existsSync(htmlTemplatePath)) {\n console.error(`Could not find the template to copy at ${htmlTemplatePath}`)\n return process.exit(1)\n }\n const targetPath = path.join(CWD, 'html-template')\n await fs.cp(htmlTemplatePath, targetPath, { recursive: true })\n}\n\nasync function makeReact () {\n const reactTemplatePath = path.join(__dirname, 'assets/react')\n if (!existsSync(reactTemplatePath)) {\n console.error(`Could not find the template to copy at ${reactTemplatePath}`)\n return process.exit(1)\n }\n const defaultTargetPath = path.join(CWD, 'react-template')\n \n // Copy\n await fs.cp(reactTemplatePath, defaultTargetPath, { recursive: true })\n const { projectName } = await prompts({\n name: 'projectName',\n message: 'Project name ? (for package.json name field)',\n type: 'text'\n })\n \n // Custom project name\n const packageJsonPath = path.join(defaultTargetPath, 'package.json')\n await Files.readWrite(packageJsonPath, rawContent => {\n const content = typeof rawContent === 'string'\n ? rawContent\n : rawContent.toString()\n const contentObj = JSON.parse(content) as Record<string, string>\n delete contentObj.name\n const newContentObj = {\n name: projectName,\n ...contentObj\n }\n return `${JSON.stringify(newContentObj, null, 2)}\\n`\n }, { encoding: 'utf-8' })\n \n // Install deps\n const npmISubprocess = spawn(`cd ${defaultTargetPath} && npm i`, { stdio: 'inherit', shell: true })\n await new Promise((resolve, reject) => {\n npmISubprocess.on('exit', () => resolve(true))\n npmISubprocess.on('error', () => reject(false))\n })\n\n // Rename project\n const targetPath = path.join(CWD, projectName)\n await fs.rename(defaultTargetPath, targetPath)\n\n // Rename gitignore\n await fs.rename(\n path.join(targetPath, 'gitignore'),\n path.join(targetPath, '.gitignore')\n )\n}\n\nasync function makeExpress () {\n const expressTemplatePath = path.join(__dirname, 'assets/express')\n if (!existsSync(expressTemplatePath)) {\n console.error(`Could not find the template to copy at ${expressTemplatePath}`)\n return process.exit(1)\n }\n const defaultTargetPath = path.join(CWD, 'express-template')\n \n // Copy\n await fs.cp(expressTemplatePath, defaultTargetPath, { recursive: true })\n const { projectName } = await prompts({\n name: 'projectName',\n message: 'Project name ? (for package.json name field)',\n type: 'text'\n })\n \n // Custom project name in package.json\n const packageJsonPath = path.join(defaultTargetPath, 'package.json')\n await Files.readWrite(packageJsonPath, rawContent => {\n const content = typeof rawContent === 'string'\n ? rawContent\n : rawContent.toString()\n const contentObj = JSON.parse(content) as Record<string, string>\n delete contentObj.name\n const newContentObj = {\n name: projectName,\n ...contentObj\n }\n return `${JSON.stringify(newContentObj, null, 2)}\\n`\n }, { encoding: 'utf-8' })\n\n // Custom project name in src/bin/start.ts\n const binStartTsPath = path.join(defaultTargetPath, 'src/bin/start.ts')\n await Files.readWrite(binStartTsPath, rawContent => {\n const originalContent = typeof rawContent === 'string'\n ? rawContent\n : rawContent.toString()\n const updatedContent = originalContent.replace('<<@mxfb/cli----replace-with-name>>', projectName)\n return updatedContent\n }, { encoding: 'utf-8' })\n \n // Install deps\n const npmISubprocess = spawn(`cd ${defaultTargetPath} && npm i`, { stdio: 'inherit', shell: true })\n await new Promise((resolve, reject) => {\n npmISubprocess.on('exit', () => resolve(true))\n npmISubprocess.on('error', () => reject(false))\n })\n\n // Rename project\n const targetPath = path.join(CWD, projectName)\n await fs.rename(defaultTargetPath, targetPath)\n\n // Rename gitignore\n await fs.rename(\n path.join(targetPath, 'gitignore'),\n path.join(targetPath, '.gitignore')\n )\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAOA,MAAa,eACpB,OAAS,YAAYC,EAAI,cAAAC,MAAkB,UAC3C,OAAOC,MAAS,WAChB,OAAOC,MAAU,YACjB,OAAS,SAAAC,MAAa,qBACtB,OAAS,WAAAC,MAAe,YACxB,OAAOC,MAAa,UACpB,OAAS,SAAAC,MAAa,0CAEtB,IAAMC,EAAaN,EAAI,cAAc,YAAY,GAAG,EAC9CO,EAAYN,EAAK,QAAQK,CAAU,EACnCE,EAAMX,EAAQ,IAAI,EAExBM,EACG,KAAK,6BAA6B,EAClC,YAAY,oCAAoC,EAEnDA,EACG,QAAQ,SAAS,EACjB,YAAY,gDAAgD,EAC5D,OAAOM,CAAW,EAErBN,EACG,QAAQ,MAAM,EACd,YAAY,oCAAoC,EAChD,OAAOO,CAAQ,EAElBP,EACG,QAAQ,OAAO,EACf,YAAY,2CAA2C,EACvD,OAAOQ,CAAS,EAEnBR,EAAQ,MAAMN,EAAQ,IAAI,EAE1B,eAAea,GAAY,CACzB,IAAME,EAAmBX,EAAK,KAAKM,EAAW,aAAa,E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Ae,GAAG,OAAQ,IAAMC,EAAQ,EAAI,CAAC,EAC7CD,EAAe,GAAG,QAAS,IAAME,EAAO,EAAK,CAAC,CAChD,CAAC,EAGD,IAAMX,EAAaZ,EAAK,KAAKO,EAAKQ,CAAW,EAC7C,MAAMlB,EAAG,OAAOiB,EAAmBF,CAAU,EAG7C,MAAMf,EAAG,OACPG,EAAK,KAAKY,EAAY,WAAW,EACjCZ,EAAK,KAAKY,EAAY,YAAY,CACpC,CACF",
|
|
6
|
+
"names": ["process", "fs", "existsSync", "url", "path", "spawn", "program", "prompts", "Files", "__filename", "__dirname", "CWD", "makeExpress", "makeHtml", "makeReact", "htmlTemplatePath", "targetPath", "reactTemplatePath", "defaultTargetPath", "projectName", "packageJsonPath", "rawContent", "content", "contentObj", "newContentObj", "npmISubprocess", "resolve", "reject", "expressTemplatePath", "binStartTsPath"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@design-edito/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.70",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Maxime Fabas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
"tree": "./tree/index.js"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@design-edito/tools": "^0.
|
|
21
|
-
"commander": "^12.
|
|
20
|
+
"@design-edito/tools": "^0.1.7",
|
|
21
|
+
"commander": "^12.1.0",
|
|
22
22
|
"prompts": "^2.4.2"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@types/node": "^
|
|
25
|
+
"@types/node": "^22.1.0",
|
|
26
26
|
"@types/prompts": "^2.4.9",
|
|
27
27
|
"@types/semver": "^7.5.8",
|
|
28
|
-
"esbuild": "^0.
|
|
29
|
-
"semver": "^7.6.
|
|
30
|
-
"simple-git": "^3.
|
|
31
|
-
"typescript": "^5.4
|
|
28
|
+
"esbuild": "^0.23.0",
|
|
29
|
+
"semver": "^7.6.3",
|
|
30
|
+
"simple-git": "^3.25.0",
|
|
31
|
+
"typescript": "^5.5.4"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/tree/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{program as b}from"commander";import
|
|
2
|
+
import{program as b}from"commander";import{isInDirectory as f}from"@design-edito/tools/node/files/is-in-directory/index.js";import{Subpaths as w}from"@design-edito/tools/node/files/subpaths/index.js";var h=process.cwd();b.name("@design-edito/tree").description("List subpaths from the current working directory").argument("[depth]","Depth (optional, defaults to 0)").option("-f, --files [bool]","Include files",i,!0).option("-H, --hidden [bool]","Include hidden files",i,!0).option("-d, --directories [bool]","Include directories",i,!0).option("-s, --symlinks [bool]","Include symlinks",i,!0).option("-F, --follow [bool]","Follow symlinks",i,!1).option("-u, --unique [bool]","Ensures followed symlinks contents don't create duplicates",i,!1).option("-e, --exclude [pattern]","Regexp patterns to exclude from the result").option("-i, --include [pattern]","Regexp patterns to include in the result").action(async(n,e)=>{let r=n!==void 0?parseInt(n):0;if(Number.isNaN(r))return console.error("Depth should be a number"),process.exit(1);let s=(await w.list(h,{maxDepth:r,files:e.files,hidden:e.hidden,directories:e.directories,symlinks:e.symlinks,followSimlinks:e.follow,dedupeSimlinksContents:e.unique,exclude:m(e.exclude),include:m(e.include),returnRelative:!0})).reduce((u,l)=>{let a=y(l),c={value:l,level:a,children:[]};u.filter(t=>t.level===a-1&&f(l,t.value)).forEach(t=>t.children.push(c));let p=u.filter(t=>t.level===a+1&&f(t.value,l));return c.children.push(...p),[...u,c]},[]);console.log(h),g(s)});b.parse(process.argv);function i(n){let e=`${n}`.trim().toLowerCase();if(e==="true")return!0;if(e==="false")return!1}function m(n){if(typeof n!="string")return;let e=/^\/(.+)\/([a-z]*)$/,r=n.match(e);if(r===null)return;let[,o,s]=r;return new RegExp(o,s)}function y(n){return n.split("/").length-1}function g(n,e=0,r=[]){n.filter(o=>o.level===e).forEach((o,s,u)=>{let l=s===u.length-1,a=l?"\u2514\u2500\u2500":"\u251C\u2500\u2500",{value:c,level:d,children:p}=o,t=c.split("/").slice(d).join("/"),v=new Array(d).fill(null).map((x,k)=>r[k]===!0?" ":"\u2502 ").join("");console.log(`${v}${a} ${t}`),g(p,d+1,[...r,l])})}
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/tree/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/tree/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { program } from 'commander'\nimport
|
|
5
|
-
"mappings": "AAAA,OAAS,WAAAA,MAAe,YACxB,
|
|
6
|
-
"names": ["program", "
|
|
4
|
+
"sourcesContent": ["import { program } from 'commander'\nimport { isInDirectory } from '@design-edito/tools/node/files/is-in-directory/index.js'\nimport { Subpaths } from '@design-edito/tools/node/files/subpaths/index.js'\n\nconst CWD = process.cwd()\n\ntype SubpathData = {\n value: string\n level: number\n children: SubpathData[]\n}\n\nprogram\n .name('@design-edito/tree')\n .description('List subpaths from the current working directory')\n .argument('[depth]', 'Depth (optional, defaults to 0)')\n .option('-f, --files [bool]', 'Include files', parseBoolean, true)\n .option('-H, --hidden [bool]', 'Include hidden files', parseBoolean, true)\n .option('-d, --directories [bool]', 'Include directories', parseBoolean, true)\n .option('-s, --symlinks [bool]', 'Include symlinks', parseBoolean, true)\n .option('-F, --follow [bool]', 'Follow symlinks', parseBoolean, false)\n .option('-u, --unique [bool]', 'Ensures followed symlinks contents don\\'t create duplicates', parseBoolean, false)\n .option('-e, --exclude [pattern]', 'Regexp patterns to exclude from the result')\n .option('-i, --include [pattern]', 'Regexp patterns to include in the result')\n .action(async (_depth, options) => {\n const depth = _depth !== undefined ? parseInt(_depth) : 0\n if (Number.isNaN(depth)) {\n console.error('Depth should be a number')\n return process.exit(1)\n }\n const subpaths = await Subpaths.list(CWD, {\n maxDepth: depth,\n files: options.files,\n hidden: options.hidden,\n directories: options.directories,\n symlinks: options.symlinks,\n followSimlinks: options.follow,\n dedupeSimlinksContents: options.unique,\n exclude: makeRegexp(options.exclude),\n include: makeRegexp(options.include),\n returnRelative: true\n })\n const subpathsData = subpaths.reduce<SubpathData[]>((reduced, subpath) => {\n const level = getLevel(subpath)\n const thisSubpathData = {\n value: subpath,\n level,\n children: [] as SubpathData[]\n }\n // Parents\n const parents = reduced.filter(subpathData => subpathData.level === level - 1 && isInDirectory(subpath, subpathData.value))\n parents.forEach(parent => parent.children.push(thisSubpathData))\n // Children\n const children = reduced.filter(subpathData => subpathData.level === level + 1 && isInDirectory(subpathData.value, subpath))\n thisSubpathData.children.push(...children)\n return [...reduced, thisSubpathData]\n }, [])\n console.log(CWD)\n printSubpathData(subpathsData)\n })\n\nprogram.parse(process.argv)\n\nfunction parseBoolean (val: unknown) {\n const strVal = `${val}`.trim().toLowerCase()\n if (strVal === 'true') return true\n if (strVal === 'false') return false\n return undefined\n}\n\nfunction makeRegexp (strRegexp: unknown) {\n if (typeof strRegexp !== 'string') return undefined\n const validRegexpRegexp = /^\\/(.+)\\/([a-z]*)$/\n const inputMatches = strRegexp.match(validRegexpRegexp)\n if (inputMatches === null) return undefined\n const [, pattern, flags] = inputMatches\n return new RegExp(pattern!, flags!)\n}\n\nfunction getLevel (path: string) {\n const chunks = path.split('/')\n return chunks.length - 1\n}\n\nfunction printSubpathData (\n subpathsData: SubpathData[],\n level: number = 0,\n parentsAreLastMap: boolean[] = []) {\n subpathsData\n .filter(subpathData => subpathData.level === level)\n .forEach((subpathsData, pos, filtered) => {\n const isLast = pos === filtered.length - 1\n const indentChar = isLast ? '\u2514\u2500\u2500' : '\u251C\u2500\u2500'\n const { value, level, children } = subpathsData\n const toPrint = value.split('/').slice(level).join('/')\n const indentChars = new Array(level).fill(null).map((e, pos) => {\n if (parentsAreLastMap[pos] === true) return ' '\n else return '\u2502 '\n }).join('')\n console.log(`${indentChars}${indentChar} ${toPrint}`)\n printSubpathData(children, level + 1, [...parentsAreLastMap, isLast])\n })\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,WAAAA,MAAe,YACxB,OAAS,iBAAAC,MAAqB,0DAC9B,OAAS,YAAAC,MAAgB,mDAEzB,IAAMC,EAAM,QAAQ,IAAI,EAQxBH,EACG,KAAK,oBAAoB,EACzB,YAAY,kDAAkD,EAC9D,SAAS,UAAW,iCAAiC,EACrD,OAAO,qBAAsB,gBAAiBI,EAAc,EAAI,EAChE,OAAO,sBAAuB,uBAAwBA,EAAc,EAAI,EACxE,OAAO,2BAA4B,sBAAuBA,EAAc,EAAI,EAC5E,OAAO,wBAAyB,mBAAoBA,EAAc,EAAI,EACtE,OAAO,sBAAuB,kBAAmBA,EAAc,EAAK,EACpE,OAAO,sBAAuB,6DAA+DA,EAAc,EAAK,EAChH,OAAO,0BAA2B,4CAA4C,EAC9E,OAAO,0BAA2B,0CAA0C,EAC5E,OAAO,MAAOC,EAAQC,IAAY,CACjC,IAAMC,EAAQF,IAAW,OAAY,SAASA,CAAM,EAAI,EACxD,GAAI,OAAO,MAAME,CAAK,EACpB,eAAQ,MAAM,0BAA0B,EACjC,QAAQ,KAAK,CAAC,EAcvB,IAAMC,GAZW,MAAMN,EAAS,KAAKC,EAAK,CACxC,SAAUI,EACV,MAAOD,EAAQ,MACf,OAAQA,EAAQ,OAChB,YAAaA,EAAQ,YACrB,SAAUA,EAAQ,SAClB,eAAgBA,EAAQ,OACxB,uBAAwBA,EAAQ,OAChC,QAASG,EAAWH,EAAQ,OAAO,EACnC,QAASG,EAAWH,EAAQ,OAAO,EACnC,eAAgB,EAClB,CAAC,GAC6B,OAAsB,CAACI,EAASC,IAAY,CACxE,IAAMC,EAAQC,EAASF,CAAO,EACxBG,EAAkB,CACtB,MAAOH,EACP,MAAAC,EACA,SAAU,CAAC,CACb,EAEgBF,EAAQ,OAAOK,GAAeA,EAAY,QAA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,MAAMtB,CAAK,EAAE,KAAK,IAAI,EAAE,IAAI,CAACuB,EAAGP,IAClDD,EAAkBC,CAAG,IAAM,GAAa,OAChC,WACb,EAAE,KAAK,EAAE,EACV,QAAQ,IAAI,GAAGM,CAAW,GAAGH,CAAU,IAAIE,CAAO,EAAE,EACpDf,EAAiBD,EAAUL,EAAQ,EAAG,CAAC,GAAGe,EAAmBG,CAAM,CAAC,CACtE,CAAC,CACL",
|
|
6
|
+
"names": ["program", "isInDirectory", "Subpaths", "CWD", "parseBoolean", "_depth", "options", "depth", "subpathsData", "makeRegexp", "reduced", "subpath", "level", "getLevel", "thisSubpathData", "subpathData", "parent", "children", "printSubpathData", "val", "strVal", "strRegexp", "validRegexpRegexp", "inputMatches", "pattern", "flags", "path", "parentsAreLastMap", "pos", "filtered", "isLast", "indentChar", "value", "toPrint", "indentChars", "e"]
|
|
7
7
|
}
|