Repository navigation
Expand file tree
/
Copy pathconstants.js
More file actions
82 lines (70 loc) · 2.2 KB
/
Copy pathconstants.js
File metadata and controls
82 lines (70 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
'use strict'
const path = require('node:path')
const registryConstants = require('@socketsecurity/registry/lib/constants')
const {
PACKAGE_JSON,
kInternalsSymbol,
[kInternalsSymbol]: { createConstantsObject }
} = registryConstants
const CONSTANTS = 'constants'
const MODULE_SYNC = 'module-sync'
const REQUIRE = 'require'
const ROLLUP_ENTRY_SUFFIX = '?commonjs-entry'
const ROLLUP_EXTERNAL_SUFFIX = '?commonjs-external'
const SLASH_NODE_MODULES_SLASH = '/node_modules/'
const VENDOR = 'vendor'
const lazyBabelConfigPath = () =>
// Lazily access constants.rootConfigPath.
path.join(constants.rootConfigPath, 'babel.config.js')
const lazyDepStatsPath = () =>
// Lazily access constants.rootPath.
path.join(constants.rootPath, '.dep-stats.json')
const lazyRootConfigPath = () =>
// Lazily access constants.rootPath.
path.join(constants.rootPath, '.config')
const lazyRootDistPath = () =>
// Lazily access constants.rootPath.
path.join(constants.rootPath, 'dist')
const lazyRootPackageJsonPath = () =>
// Lazily access constants.rootPath.
path.join(constants.rootPath, PACKAGE_JSON)
const lazyRootPath = () => path.resolve(__dirname, '..')
const lazyRootSrcPath = () =>
// Lazily access constants.rootPath.
path.join(constants.rootPath, 'src')
const lazyTsconfigPath = () =>
// Lazily access constants.rootConfigPath.
path.join(constants.rootConfigPath, 'tsconfig.rollup.json')
const constants = createConstantsObject(
{
CONSTANTS,
MODULE_SYNC,
REQUIRE,
ROLLUP_ENTRY_SUFFIX,
ROLLUP_EXTERNAL_SUFFIX,
SLASH_NODE_MODULES_SLASH,
VENDOR,
babelConfigPath: undefined,
depStatsPath: undefined,
rootConfigPath: undefined,
rootDistPath: undefined,
rootPackageJsonPath: undefined,
rootPath: undefined,
rootSrcPath: undefined,
tsconfigPath: undefined
},
{
getters: {
babelConfigPath: lazyBabelConfigPath,
depStatsPath: lazyDepStatsPath,
rootConfigPath: lazyRootConfigPath,
rootDistPath: lazyRootDistPath,
rootPackageJsonPath: lazyRootPackageJsonPath,
rootPath: lazyRootPath,
rootSrcPath: lazyRootSrcPath,
tsconfigPath: lazyTsconfigPath
},
mixin: registryConstants
}
)
module.exports = constants