@aeolus-fleet/console 0.30.0 → 0.30.1

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 (107) hide show
  1. package/.next/standalone/packages/console/.next/BUILD_ID +1 -1
  2. package/.next/standalone/packages/console/.next/build-manifest.json +3 -3
  3. package/.next/standalone/packages/console/.next/node_modules/import-in-the-middle-ac114f323ad7e863/index.js +221 -0
  4. package/.next/standalone/packages/console/.next/node_modules/import-in-the-middle-ac114f323ad7e863/lib/register.js +285 -0
  5. package/.next/standalone/packages/console/.next/node_modules/import-in-the-middle-ac114f323ad7e863/package.json +66 -0
  6. package/.next/standalone/packages/console/.next/node_modules/require-in-the-middle-2ca7b9c2766f317e/index.js +333 -0
  7. package/.next/standalone/packages/console/.next/node_modules/require-in-the-middle-2ca7b9c2766f317e/package.json +57 -0
  8. package/.next/standalone/packages/console/.next/prerender-manifest.json +3 -3
  9. package/.next/standalone/packages/console/.next/server/app/(console)/fleet-health/[cause]/page/server-reference-manifest.json +14 -14
  10. package/.next/standalone/packages/console/.next/server/app/(console)/fleet-health/[cause]/page.js.nft.json +1 -1
  11. package/.next/standalone/packages/console/.next/server/app/(console)/fleet-health/[cause]/page_client-reference-manifest.js +1 -1
  12. package/.next/standalone/packages/console/.next/server/app/(console)/fleet-health/page/server-reference-manifest.json +14 -14
  13. package/.next/standalone/packages/console/.next/server/app/(console)/fleet-health/page.js.nft.json +1 -1
  14. package/.next/standalone/packages/console/.next/server/app/(console)/fleet-health/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/packages/console/.next/server/app/(console)/inbox/page/server-reference-manifest.json +14 -14
  16. package/.next/standalone/packages/console/.next/server/app/(console)/inbox/page.js.nft.json +1 -1
  17. package/.next/standalone/packages/console/.next/server/app/(console)/inbox/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/packages/console/.next/server/app/(console)/labels/page/server-reference-manifest.json +14 -14
  19. package/.next/standalone/packages/console/.next/server/app/(console)/labels/page.js.nft.json +1 -1
  20. package/.next/standalone/packages/console/.next/server/app/(console)/labels/page_client-reference-manifest.js +1 -1
  21. package/.next/standalone/packages/console/.next/server/app/(console)/needs-attention/page/server-reference-manifest.json +14 -14
  22. package/.next/standalone/packages/console/.next/server/app/(console)/needs-attention/page.js.nft.json +1 -1
  23. package/.next/standalone/packages/console/.next/server/app/(console)/needs-attention/page_client-reference-manifest.js +1 -1
  24. package/.next/standalone/packages/console/.next/server/app/(console)/needs-crew/page/server-reference-manifest.json +14 -14
  25. package/.next/standalone/packages/console/.next/server/app/(console)/needs-crew/page.js.nft.json +1 -1
  26. package/.next/standalone/packages/console/.next/server/app/(console)/needs-crew/page_client-reference-manifest.js +1 -1
  27. package/.next/standalone/packages/console/.next/server/app/(console)/network/page/server-reference-manifest.json +14 -14
  28. package/.next/standalone/packages/console/.next/server/app/(console)/network/page.js.nft.json +1 -1
  29. package/.next/standalone/packages/console/.next/server/app/(console)/network/page_client-reference-manifest.js +1 -1
  30. package/.next/standalone/packages/console/.next/server/app/(console)/page/server-reference-manifest.json +14 -14
  31. package/.next/standalone/packages/console/.next/server/app/(console)/page.js.nft.json +1 -1
  32. package/.next/standalone/packages/console/.next/server/app/(console)/page_client-reference-manifest.js +1 -1
  33. package/.next/standalone/packages/console/.next/server/app/(console)/settings/page/server-reference-manifest.json +14 -14
  34. package/.next/standalone/packages/console/.next/server/app/(console)/settings/page.js.nft.json +1 -1
  35. package/.next/standalone/packages/console/.next/server/app/(console)/settings/page_client-reference-manifest.js +1 -1
  36. package/.next/standalone/packages/console/.next/server/app/(console)/ships/[shipId]/page/server-reference-manifest.json +14 -14
  37. package/.next/standalone/packages/console/.next/server/app/(console)/ships/[shipId]/page.js.nft.json +1 -1
  38. package/.next/standalone/packages/console/.next/server/app/(console)/ships/[shipId]/page_client-reference-manifest.js +1 -1
  39. package/.next/standalone/packages/console/.next/server/app/(console)/squadrons/[squadronId]/page/server-reference-manifest.json +14 -14
  40. package/.next/standalone/packages/console/.next/server/app/(console)/squadrons/[squadronId]/page.js.nft.json +1 -1
  41. package/.next/standalone/packages/console/.next/server/app/(console)/squadrons/[squadronId]/page_client-reference-manifest.js +1 -1
  42. package/.next/standalone/packages/console/.next/server/app/(console)/squadrons/blueprints/[name]/page/server-reference-manifest.json +14 -14
  43. package/.next/standalone/packages/console/.next/server/app/(console)/squadrons/blueprints/[name]/page.js.nft.json +1 -1
  44. package/.next/standalone/packages/console/.next/server/app/(console)/squadrons/blueprints/[name]/page_client-reference-manifest.js +1 -1
  45. package/.next/standalone/packages/console/.next/server/app/(console)/squadrons/page/server-reference-manifest.json +14 -14
  46. package/.next/standalone/packages/console/.next/server/app/(console)/squadrons/page.js.nft.json +1 -1
  47. package/.next/standalone/packages/console/.next/server/app/(console)/squadrons/page_client-reference-manifest.js +1 -1
  48. package/.next/standalone/packages/console/.next/server/app/(console)/squadrons/templates/[name]/page/server-reference-manifest.json +14 -14
  49. package/.next/standalone/packages/console/.next/server/app/(console)/squadrons/templates/[name]/page.js.nft.json +1 -1
  50. package/.next/standalone/packages/console/.next/server/app/(console)/squadrons/templates/[name]/page_client-reference-manifest.js +1 -1
  51. package/.next/standalone/packages/console/.next/server/app/(console)/trierarchs/[shipId]/page/server-reference-manifest.json +14 -14
  52. package/.next/standalone/packages/console/.next/server/app/(console)/trierarchs/[shipId]/page.js.nft.json +1 -1
  53. package/.next/standalone/packages/console/.next/server/app/(console)/trierarchs/[shipId]/page_client-reference-manifest.js +1 -1
  54. package/.next/standalone/packages/console/.next/server/app/(console)/trierarchs/page/server-reference-manifest.json +14 -14
  55. package/.next/standalone/packages/console/.next/server/app/(console)/trierarchs/page.js.nft.json +1 -1
  56. package/.next/standalone/packages/console/.next/server/app/(console)/trierarchs/page_client-reference-manifest.js +1 -1
  57. package/.next/standalone/packages/console/.next/server/app/_global-error.html +1 -1
  58. package/.next/standalone/packages/console/.next/server/app/_global-error.rsc +1 -1
  59. package/.next/standalone/packages/console/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  60. package/.next/standalone/packages/console/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  61. package/.next/standalone/packages/console/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  62. package/.next/standalone/packages/console/.next/server/app/api/reads/[read]/route.js.nft.json +1 -1
  63. package/.next/standalone/packages/console/.next/server/app/version/route.js.nft.json +1 -1
  64. package/.next/standalone/packages/console/.next/server/chunks/[root-of-the-server]__0-b_d8j._.js +1 -1
  65. package/.next/standalone/packages/console/.next/server/chunks/[root-of-the-server]__0w4s32w._.js +1 -1
  66. package/.next/standalone/packages/console/.next/server/chunks/ssr/{0ysl_console_features_trierarchs_ui_organisms_clear-worktree-dialog_tsx_1rm9l2e._.js → 0ysl_console_features_trierarchs_ui_organisms_clear-worktree-dialog_tsx_1cj5i3d._.js} +1 -1
  67. package/.next/standalone/packages/console/.next/server/chunks/ssr/_0bdsmu0._.js +1 -1
  68. package/.next/standalone/packages/console/.next/server/chunks/ssr/{_0bzwxa5._.js → _0h-jnay._.js} +1 -1
  69. package/.next/standalone/packages/console/.next/server/chunks/ssr/{_0vw3hp0._.js → _135805g._.js} +1 -1
  70. package/.next/standalone/packages/console/.next/server/chunks/ssr/{_1eaafw1._.js → _18owi6c._.js} +1 -1
  71. package/.next/standalone/packages/console/.next/server/chunks/ssr/_1hsu1v2._.js +1 -1
  72. package/.next/standalone/packages/console/.next/server/chunks/ssr/{_1wqk91b._.js → _1ia6sfj._.js} +1 -1
  73. package/.next/standalone/packages/console/.next/server/chunks/ssr/_1u0h4gj._.js +1 -1
  74. package/.next/standalone/packages/console/.next/server/chunks/ssr/{_0bzikib._.js → _20ltycf._.js} +2 -2
  75. package/.next/standalone/packages/console/.next/server/chunks/ssr/packages_console_00qg_s6._.js +1 -1
  76. package/.next/standalone/packages/console/.next/server/chunks/ssr/packages_console_02v53na._.js +1 -1
  77. package/.next/standalone/packages/console/.next/server/chunks/ssr/packages_console_02wkudy._.js +1 -1
  78. package/.next/standalone/packages/console/.next/server/chunks/ssr/packages_console_04rox65._.js +1 -1
  79. package/.next/standalone/packages/console/.next/server/chunks/ssr/packages_console_05zitd2._.js +1 -1
  80. package/.next/standalone/packages/console/.next/server/chunks/ssr/packages_console_065nea1._.js +1 -1
  81. package/.next/standalone/packages/console/.next/server/chunks/ssr/packages_console_0h_376h._.js +1 -1
  82. package/.next/standalone/packages/console/.next/server/chunks/ssr/packages_console_0ko_ogs._.js +1 -1
  83. package/.next/standalone/packages/console/.next/server/chunks/ssr/packages_console_0sr2-oa._.js +1 -1
  84. package/.next/standalone/packages/console/.next/server/chunks/ssr/packages_console_0ysbad7._.js +1 -1
  85. package/.next/standalone/packages/console/.next/server/chunks/ssr/packages_console_108sez2._.js +1 -1
  86. package/.next/standalone/packages/console/.next/server/chunks/ssr/{packages_console_1pslvww._.js → packages_console_1e33jj3._.js} +1 -1
  87. package/.next/standalone/packages/console/.next/server/chunks/ssr/packages_console_1jy5-0g._.js +1 -1
  88. package/.next/standalone/packages/console/.next/server/chunks/ssr/{packages_console_1pyirkn._.js → packages_console_1k1crw1._.js} +1 -1
  89. package/.next/standalone/packages/console/.next/server/chunks/ssr/packages_console_1n8w8x0._.js +1 -1
  90. package/.next/standalone/packages/console/.next/server/chunks/ssr/packages_console_1oz8iu7._.js +1 -1
  91. package/.next/standalone/packages/console/.next/server/chunks/ssr/{packages_console_11tdbkt._.js → packages_console_1qi485p._.js} +1 -1
  92. package/.next/standalone/packages/console/.next/server/chunks/ssr/packages_console_1rdu3gt._.js +1 -1
  93. package/.next/standalone/packages/console/.next/server/chunks/ssr/packages_console_1yfimad._.js +1 -1
  94. package/.next/standalone/packages/console/.next/server/chunks/ssr/{packages_console_components_organisms_crew-line-dialog_tsx_03yc7m2._.js → packages_console_components_organisms_crew-line-dialog_tsx_11y3we6._.js} +1 -1
  95. package/.next/standalone/packages/console/.next/server/chunks/ssr/{packages_console_features_squadrons_organisms_form-squadron-dialog_tsx_080dycl._.js → packages_console_features_squadrons_organisms_form-squadron-dialog_tsx_04jnwy5._.js} +1 -1
  96. package/.next/standalone/packages/console/.next/server/middleware-build-manifest.js +3 -3
  97. package/.next/standalone/packages/console/.next/server/pages/500.html +1 -1
  98. package/.next/standalone/packages/console/.next/server/server-reference-manifest.js +1 -1
  99. package/.next/standalone/packages/console/.next/server/server-reference-manifest.json +15 -15
  100. package/.next/standalone/packages/console/.next/static/chunks/{3aavctmtw4-fi.js → 046j0y9wgycm0.js} +1 -1
  101. package/.next/standalone/packages/console/.next/static/chunks/{1dwd950z6uq3v.js → 180jsws8b9eq6.js} +1 -1
  102. package/.next/standalone/packages/console/.next/static/chunks/{0w5mjb10dj8-h.js → 20zd_xtfl07ru.js} +1 -1
  103. package/.next/standalone/packages/console/package.json +3 -3
  104. package/package.json +3 -3
  105. /package/.next/standalone/packages/console/.next/static/{10-qWFsL7UDAGlmmFXFB- → FhQ486AZAouB_wqS1YEzn}/_buildManifest.js +0 -0
  106. /package/.next/standalone/packages/console/.next/static/{10-qWFsL7UDAGlmmFXFB- → FhQ486AZAouB_wqS1YEzn}/_clientMiddlewareManifest.js +0 -0
  107. /package/.next/standalone/packages/console/.next/static/{10-qWFsL7UDAGlmmFXFB- → FhQ486AZAouB_wqS1YEzn}/_ssgManifest.js +0 -0
@@ -0,0 +1,333 @@
1
+ 'use strict'
2
+
3
+ const path = require('path')
4
+ const Module = require('module')
5
+ const debug = require('debug')('require-in-the-middle')
6
+ const moduleDetailsFromPath = require('module-details-from-path')
7
+
8
+ // Using the default export is discouraged, but kept for backward compatibility.
9
+ // Use this instead:
10
+ // const { Hook } = require('require-in-the-middle')
11
+ module.exports = Hook
12
+ module.exports.Hook = Hook
13
+
14
+ let builtinModules // Set<string>
15
+
16
+ /**
17
+ * Is the given module a "core" module?
18
+ * https://nodejs.org/api/modules.html#core-modules
19
+ *
20
+ * @type {(moduleName: string) => boolean}
21
+ */
22
+ let isCore
23
+ if (Module.isBuiltin) { // Added in node v18.6.0, v16.17.0
24
+ isCore = Module.isBuiltin
25
+ } else if (Module.builtinModules) { // Added in node v9.3.0, v8.10.0, v6.13.0
26
+ isCore = moduleName => {
27
+ if (moduleName.startsWith('node:')) {
28
+ return true
29
+ }
30
+
31
+ if (builtinModules === undefined) {
32
+ builtinModules = new Set(Module.builtinModules)
33
+ }
34
+
35
+ return builtinModules.has(moduleName)
36
+ }
37
+ } else {
38
+ throw new Error('\'require-in-the-middle\' requires Node.js >=v9.3.0 or >=v8.10.0')
39
+ }
40
+
41
+ // 'foo/bar.js' or 'foo/bar/index.js' => 'foo/bar'
42
+ const normalize = /([/\\]index)?(\.js)?$/
43
+
44
+ // Cache `onrequire`-patched exports for modules.
45
+ //
46
+ // Exports for built-in (a.k.a. "core") modules are stored in an internal Map.
47
+ //
48
+ // Exports for non-core modules are stored on a private field on the `Module`
49
+ // object in `require.cache`. This allows users to delete from `require.cache`
50
+ // to trigger a re-load (and re-run of the hook's `onrequire`) of a module the
51
+ // next time it is required.
52
+ // https://nodejs.org/docs/latest/api/all.html#all_modules_requirecache
53
+ //
54
+ // In some special cases -- e.g. some other `require()` hook swapping out
55
+ // `Module._cache` like `@babel/register` -- a non-core module won't be in
56
+ // `require.cache`. In that case this falls back to caching on the internal Map.
57
+ class ExportsCache {
58
+ constructor () {
59
+ this._localCache = new Map() // <module filename or id> -> <exports>
60
+ this._kRitmExports = Symbol('RitmExports')
61
+ }
62
+
63
+ has (filename, isBuiltin) {
64
+ if (this._localCache.has(filename)) {
65
+ return true
66
+ } else if (!isBuiltin) {
67
+ const mod = require.cache[filename]
68
+ return !!(mod && this._kRitmExports in mod)
69
+ } else {
70
+ return false
71
+ }
72
+ }
73
+
74
+ get (filename, isBuiltin) {
75
+ const cachedExports = this._localCache.get(filename)
76
+ if (cachedExports !== undefined) {
77
+ return cachedExports
78
+ } else if (!isBuiltin) {
79
+ const mod = require.cache[filename]
80
+ return (mod && mod[this._kRitmExports])
81
+ }
82
+ }
83
+
84
+ set (filename, exports, isBuiltin) {
85
+ if (isBuiltin) {
86
+ this._localCache.set(filename, exports)
87
+ } else if (filename in require.cache) {
88
+ require.cache[filename][this._kRitmExports] = exports
89
+ } else {
90
+ debug('non-core module is unexpectedly not in require.cache: "%s"', filename)
91
+ this._localCache.set(filename, exports)
92
+ }
93
+ }
94
+ }
95
+
96
+ function Hook (modules, options, onrequire) {
97
+ if ((this instanceof Hook) === false) return new Hook(modules, options, onrequire)
98
+ if (typeof modules === 'function') {
99
+ onrequire = modules
100
+ modules = null
101
+ options = null
102
+ } else if (typeof options === 'function') {
103
+ onrequire = options
104
+ options = null
105
+ }
106
+
107
+ if (typeof Module._resolveFilename !== 'function') {
108
+ console.error('Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!', typeof Module._resolveFilename)
109
+ console.error('Please report this error as an issue related to Node.js %s at https://github.com/nodejs/require-in-the-middle/issues', process.version)
110
+ return
111
+ }
112
+
113
+ this._cache = new ExportsCache()
114
+
115
+ this._unhooked = false
116
+ this._origRequire = Module.prototype.require
117
+
118
+ const self = this
119
+ const patching = new Set()
120
+ const internals = options ? options.internals === true : false
121
+ const hasWhitelist = Array.isArray(modules)
122
+
123
+ debug('registering require hook')
124
+
125
+ this._require = Module.prototype.require = function (id) {
126
+ if (self._unhooked === true) {
127
+ // if the patched require function could not be removed because
128
+ // someone else patched it after it was patched here, we just
129
+ // abort and pass the request onwards to the original require
130
+ debug('ignoring require call - module is soft-unhooked')
131
+ return self._origRequire.apply(this, arguments)
132
+ }
133
+
134
+ return patchedRequire.call(this, arguments, false)
135
+ }
136
+
137
+ if (typeof process.getBuiltinModule === 'function') {
138
+ this._origGetBuiltinModule = process.getBuiltinModule
139
+ this._getBuiltinModule = process.getBuiltinModule = function (id) {
140
+ if (self._unhooked === true) {
141
+ // if the patched process.getBuiltinModule function could not be removed because
142
+ // someone else patched it after it was patched here, we just abort and pass the
143
+ // request onwards to the original process.getBuiltinModule
144
+ debug('ignoring process.getBuiltinModule call - module is soft-unhooked')
145
+ return self._origGetBuiltinModule.apply(this, arguments)
146
+ }
147
+
148
+ return patchedRequire.call(this, arguments, true)
149
+ }
150
+ }
151
+
152
+ // Preserve the original require/process.getBuiltinModule arguments in `args`
153
+ function patchedRequire (args, coreOnly) {
154
+ const id = args[0]
155
+ const core = isCore(id)
156
+ let filename // the string used for caching
157
+ if (core) {
158
+ filename = id
159
+ // If this is a builtin module that can be identified both as 'foo' and
160
+ // 'node:foo', then prefer 'foo' as the caching key.
161
+ if (id.startsWith('node:')) {
162
+ const idWithoutPrefix = id.slice(5)
163
+ if (isCore(idWithoutPrefix)) {
164
+ filename = idWithoutPrefix
165
+ }
166
+ }
167
+ } else if (coreOnly) {
168
+ // `coreOnly` is `true` if this was a call to `process.getBuiltinModule`, in which case
169
+ // we don't want to return anything if the requested `id` isn't a core module. Falling
170
+ // back to default behaviour, which at the time of this wrting is simply returning `undefined`
171
+ debug('call to process.getBuiltinModule with unknown built-in id')
172
+ return self._origGetBuiltinModule.apply(this, args)
173
+ } else {
174
+ try {
175
+ filename = Module._resolveFilename(id, this)
176
+ } catch (resolveErr) {
177
+ // If someone *else* monkey-patches before this monkey-patch, then that
178
+ // code might expect `require(someId)` to get through so it can be
179
+ // handled, even if `someId` cannot be resolved to a filename. In this
180
+ // case, instead of throwing we defer to the underlying `require`.
181
+ //
182
+ // For example the Azure Functions Node.js worker module does this,
183
+ // where `@azure/functions-core` resolves to an internal object.
184
+ // https://github.com/Azure/azure-functions-nodejs-worker/blob/v3.5.2/src/setupCoreModule.ts#L46-L54
185
+ debug('Module._resolveFilename("%s") threw %j, calling original Module.require', id, resolveErr.message)
186
+ return self._origRequire.apply(this, args)
187
+ }
188
+ }
189
+
190
+ let moduleName, basedir
191
+
192
+ debug('processing %s module require(\'%s\'): %s', core === true ? 'core' : 'non-core', id, filename)
193
+
194
+ // return known patched modules immediately
195
+ if (self._cache.has(filename, core) === true) {
196
+ debug('returning already patched cached module: %s', filename)
197
+ return self._cache.get(filename, core)
198
+ }
199
+
200
+ // Check if this module has a patcher in-progress already.
201
+ // Otherwise, mark this module as patching in-progress.
202
+ const isPatching = patching.has(filename)
203
+ if (isPatching === false) {
204
+ patching.add(filename)
205
+ }
206
+
207
+ const exports = coreOnly
208
+ ? self._origGetBuiltinModule.apply(this, args)
209
+ : self._origRequire.apply(this, args)
210
+
211
+ // If it's already patched, just return it as-is.
212
+ if (isPatching === true) {
213
+ debug('module is in the process of being patched already - ignoring: %s', filename)
214
+ return exports
215
+ }
216
+
217
+ // The module has already been loaded,
218
+ // so the patching mark can be cleaned up.
219
+ patching.delete(filename)
220
+
221
+ if (core === true) {
222
+ if (hasWhitelist === true && modules.includes(filename) === false) {
223
+ debug('ignoring core module not on whitelist: %s', filename)
224
+ return exports // abort if module name isn't on whitelist
225
+ }
226
+ moduleName = filename
227
+ } else if (hasWhitelist === true && modules.includes(filename)) {
228
+ // whitelist includes the absolute path to the file including extension
229
+ const parsedPath = path.parse(filename)
230
+ moduleName = parsedPath.name
231
+ basedir = parsedPath.dir
232
+ } else {
233
+ const stat = moduleDetailsFromPath(filename)
234
+ if (stat === undefined) {
235
+ debug('could not parse filename: %s', filename)
236
+ return exports // abort if filename could not be parsed
237
+ }
238
+ moduleName = stat.name
239
+ basedir = stat.basedir
240
+
241
+ // Ex: require('foo/lib/../bar.js')
242
+ // moduleName = 'foo'
243
+ // fullModuleName = 'foo/bar'
244
+ const fullModuleName = resolveModuleName(stat)
245
+
246
+ debug('resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)', moduleName, id, fullModuleName, basedir)
247
+
248
+ let matchFound = false
249
+ if (hasWhitelist) {
250
+ if (!id.startsWith('.') && modules.includes(id)) {
251
+ // Not starting with '.' means `id` is identifying a module path,
252
+ // as opposed to a local file path. (Note: I'm not sure about
253
+ // absolute paths, but those are handled above.)
254
+ // If this `id` is in `modules`, then this could be a match to an
255
+ // package "exports" entry point that wouldn't otherwise match below.
256
+ moduleName = id
257
+ matchFound = true
258
+ }
259
+
260
+ // abort if module name isn't on whitelist
261
+ if (!modules.includes(moduleName) && !modules.includes(fullModuleName)) {
262
+ return exports
263
+ }
264
+
265
+ if (modules.includes(fullModuleName) && fullModuleName !== moduleName) {
266
+ // if we get to this point, it means that we're requiring a whitelisted sub-module
267
+ moduleName = fullModuleName
268
+ matchFound = true
269
+ }
270
+ }
271
+
272
+ if (!matchFound) {
273
+ // figure out if this is the main module file, or a file inside the module
274
+ let res
275
+ try {
276
+ res = require.resolve(moduleName, { paths: [basedir] })
277
+ } catch (e) {
278
+ debug('could not resolve module: %s', moduleName)
279
+ self._cache.set(filename, exports, core)
280
+ return exports // abort if module could not be resolved (e.g. no main in package.json and no index.js file)
281
+ }
282
+
283
+ if (res !== filename) {
284
+ // this is a module-internal file
285
+ if (internals === true) {
286
+ // use the module-relative path to the file, prefixed by original module name
287
+ moduleName = moduleName + path.sep + path.relative(basedir, filename)
288
+ debug('preparing to process require of internal file: %s', moduleName)
289
+ } else {
290
+ debug('ignoring require of non-main module file: %s', res)
291
+ self._cache.set(filename, exports, core)
292
+ return exports // abort if not main module file
293
+ }
294
+ }
295
+ }
296
+ }
297
+
298
+ // ensure that the cache entry is assigned a value before calling
299
+ // onrequire, in case calling onrequire requires the same module.
300
+ self._cache.set(filename, exports, core)
301
+ debug('calling require hook: %s', moduleName)
302
+ const patchedExports = onrequire(exports, moduleName, basedir)
303
+ self._cache.set(filename, patchedExports, core)
304
+
305
+ debug('returning module: %s', moduleName)
306
+ return patchedExports
307
+ }
308
+ }
309
+
310
+ Hook.prototype.unhook = function () {
311
+ this._unhooked = true
312
+
313
+ if (this._require === Module.prototype.require) {
314
+ Module.prototype.require = this._origRequire
315
+ debug('require unhook successful')
316
+ } else {
317
+ debug('require unhook unsuccessful')
318
+ }
319
+
320
+ if (process.getBuiltinModule !== undefined) {
321
+ if (this._getBuiltinModule === process.getBuiltinModule) {
322
+ process.getBuiltinModule = this._origGetBuiltinModule
323
+ debug('process.getBuiltinModule unhook successful')
324
+ } else {
325
+ debug('process.getBuiltinModule unhook unsuccessful')
326
+ }
327
+ }
328
+ }
329
+
330
+ function resolveModuleName (stat) {
331
+ const normalizedPath = path.sep !== '/' ? stat.path.split(path.sep).join('/') : stat.path
332
+ return path.posix.join(stat.name, normalizedPath).replace(normalize, '')
333
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "require-in-the-middle",
3
+ "version": "8.0.1",
4
+ "description": "Module to hook into the Node.js require function",
5
+ "main": "index.js",
6
+ "types": "types/index.d.ts",
7
+ "dependencies": {
8
+ "debug": "^4.3.5",
9
+ "module-details-from-path": "^1.0.3"
10
+ },
11
+ "devDependencies": {
12
+ "@babel/core": "^7.9.0",
13
+ "@babel/preset-env": "^7.9.5",
14
+ "@babel/preset-typescript": "^7.9.0",
15
+ "@babel/register": "^7.9.0",
16
+ "ipp-printer": "^1.0.0",
17
+ "patterns": "^1.0.3",
18
+ "roundround": "^0.2.0",
19
+ "semver": "^6.3.0",
20
+ "standard": "^14.3.1",
21
+ "tape": "^4.11.0"
22
+ },
23
+ "scripts": {
24
+ "test": "npm run test:lint && npm run test:tape && npm run test:babel",
25
+ "test:lint": "standard",
26
+ "test:tape": "tape test/*.js",
27
+ "test:babel": "node test/babel/babel-register.js"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/nodejs/require-in-the-middle.git"
32
+ },
33
+ "keywords": [
34
+ "require",
35
+ "hook",
36
+ "shim",
37
+ "shimmer",
38
+ "shimming",
39
+ "patch",
40
+ "monkey",
41
+ "monkeypatch",
42
+ "module",
43
+ "load"
44
+ ],
45
+ "files": [
46
+ "types"
47
+ ],
48
+ "author": "Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)",
49
+ "license": "MIT",
50
+ "bugs": {
51
+ "url": "https://github.com/nodejs/require-in-the-middle/issues"
52
+ },
53
+ "homepage": "https://github.com/nodejs/require-in-the-middle#readme",
54
+ "engines": {
55
+ "node": ">=9.3.0 || >=8.10.0 <9.0.0"
56
+ }
57
+ }
@@ -65,8 +65,8 @@
65
65
  "dynamicRoutes": {},
66
66
  "notFoundRoutes": [],
67
67
  "preview": {
68
- "previewModeId": "9992e98ff644e7b5a68e238045fe8c61",
69
- "previewModeSigningKey": "ca44fdd765ceeacffe2b5f41cec35cc513be0ef115d4e8665665388b38c98f22",
70
- "previewModeEncryptionKey": "e541a215ec49de8cff59a18aa58e64c4b1ad25335e2a3d69a80c2218c211f3e7"
68
+ "previewModeId": "606a5c878c2cc8906ff35e4ace6a0b4e",
69
+ "previewModeSigningKey": "dd46c64a99d78d351f0c167a8cb5e0363f2b51567adef70a387d7deaf5e47032",
70
+ "previewModeEncryptionKey": "bc7ded09d539af1cba4e5916b949d47385816d9d5fc9a843d19b3c913d19755c"
71
71
  }
72
72
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "node": {
3
- "0053b8b4d465fb31104ac3b7e99de8c7071ef81d55": {
3
+ "0071f1d0dcd2ee31a3a0eb20026fd44d5bcf894807": {
4
4
  "workers": {
5
5
  "app/(console)/fleet-health/[cause]/page": {
6
6
  "moduleId": 752012,
@@ -11,7 +11,7 @@
11
11
  "exportedName": "connectSquadrons",
12
12
  "filename": "packages/console/lib/squadrons-actions.ts"
13
13
  },
14
- "40c0e3e47f47d7ed3093a4cb873311c00cbbacc4fe": {
14
+ "40164adf6b2fb1adaf26eb5633828ca2f113a5502b": {
15
15
  "workers": {
16
16
  "app/(console)/fleet-health/[cause]/page": {
17
17
  "moduleId": 752012,
@@ -22,7 +22,7 @@
22
22
  "exportedName": "addMember",
23
23
  "filename": "packages/console/lib/squadrons-actions.ts"
24
24
  },
25
- "40a0dee6ad44e43746d9c3d04af4ce303aaaaa8dc6": {
25
+ "404e4bb91700b7c02339b0a7c0dbcc33ebe0af00a7": {
26
26
  "workers": {
27
27
  "app/(console)/fleet-health/[cause]/page": {
28
28
  "moduleId": 752012,
@@ -33,7 +33,7 @@
33
33
  "exportedName": "addRepository",
34
34
  "filename": "packages/console/lib/squadrons-actions.ts"
35
35
  },
36
- "40a70ccbc5379c38ce60b3409b78f7da95eb9d4df4": {
36
+ "4028d81fa7d21990186b2ad6181e9e914b188c2ed2": {
37
37
  "workers": {
38
38
  "app/(console)/fleet-health/[cause]/page": {
39
39
  "moduleId": 752012,
@@ -44,7 +44,7 @@
44
44
  "exportedName": "forceStandDown",
45
45
  "filename": "packages/console/lib/squadrons-actions.ts"
46
46
  },
47
- "40a53978cebce392e488b9171be98b67686a950068": {
47
+ "40dee9b275f00fed3fc6fd16c075aa3e1be204d60c": {
48
48
  "workers": {
49
49
  "app/(console)/fleet-health/[cause]/page": {
50
50
  "moduleId": 752012,
@@ -55,7 +55,7 @@
55
55
  "exportedName": "formSquadron",
56
56
  "filename": "packages/console/lib/squadrons-actions.ts"
57
57
  },
58
- "409be905479f2597c53cd1ce8b54d8f01fb7a79d06": {
58
+ "408844237367bfc7ea1d817c06590d66924295fbd3": {
59
59
  "workers": {
60
60
  "app/(console)/fleet-health/[cause]/page": {
61
61
  "moduleId": 752012,
@@ -66,7 +66,7 @@
66
66
  "exportedName": "newCrewLine",
67
67
  "filename": "packages/console/lib/squadrons-actions.ts"
68
68
  },
69
- "00a0d61c5f8853dcb3417e47a07901aa8cd23a7147": {
69
+ "00e714e794b49e392263fd7cb92a7bfdfaf77d6b95": {
70
70
  "workers": {
71
71
  "app/(console)/fleet-health/[cause]/page": {
72
72
  "moduleId": 752012,
@@ -77,7 +77,7 @@
77
77
  "exportedName": "refreshCatalogue",
78
78
  "filename": "packages/console/lib/squadrons-actions.ts"
79
79
  },
80
- "409a2861e97f8d6f702f5c0f2acdd56668a46b747c": {
80
+ "4005c0ee1c3af1af9d69f93e02581eaf5527f99b19": {
81
81
  "workers": {
82
82
  "app/(console)/fleet-health/[cause]/page": {
83
83
  "moduleId": 752012,
@@ -88,7 +88,7 @@
88
88
  "exportedName": "removeMember",
89
89
  "filename": "packages/console/lib/squadrons-actions.ts"
90
90
  },
91
- "40b97ed1ba01494d49f4305c01c127a24c87e39b8b": {
91
+ "40bc7068316e672da800a5e6c433aa144cf52c361f": {
92
92
  "workers": {
93
93
  "app/(console)/fleet-health/[cause]/page": {
94
94
  "moduleId": 752012,
@@ -99,7 +99,7 @@
99
99
  "exportedName": "removeRepository",
100
100
  "filename": "packages/console/lib/squadrons-actions.ts"
101
101
  },
102
- "40cbcd2bd5c91c7a32eda2e6ba2cd07ad64ec5c86b": {
102
+ "40292c0da190aeac8d721dcae17e0dabd48ca783b8": {
103
103
  "workers": {
104
104
  "app/(console)/fleet-health/[cause]/page": {
105
105
  "moduleId": 752012,
@@ -110,7 +110,7 @@
110
110
  "exportedName": "standDown",
111
111
  "filename": "packages/console/lib/squadrons-actions.ts"
112
112
  },
113
- "00736b3c0d28572f0a02bdaba546247cba28f80e8c": {
113
+ "004ecae005841c1a1351e07f63fb8087e96195a1d4": {
114
114
  "workers": {
115
115
  "app/(console)/fleet-health/[cause]/page": {
116
116
  "moduleId": 752012,
@@ -121,7 +121,7 @@
121
121
  "exportedName": "connectGateway",
122
122
  "filename": "packages/console/lib/gateway-actions.ts"
123
123
  },
124
- "003a13b5e3714ef3fcddc2e56fc62f1273602b9a91": {
124
+ "009d06e80d66526e3c6e6509744e8d40a79a3fdb04": {
125
125
  "workers": {
126
126
  "app/(console)/fleet-health/[cause]/page": {
127
127
  "moduleId": 752012,
@@ -132,7 +132,7 @@
132
132
  "exportedName": "connectTrierarchPlugin",
133
133
  "filename": "packages/console/lib/trierarch-plugin-actions.ts"
134
134
  },
135
- "40bbdf3b4ec0e85ec3b1b45d78001e0ebfaf97e7c3": {
135
+ "40363316a4d7940b6d701b683981de09579ca684ba": {
136
136
  "workers": {
137
137
  "app/(console)/fleet-health/[cause]/page": {
138
138
  "moduleId": 752012,
@@ -143,7 +143,7 @@
143
143
  "exportedName": "joinMachine",
144
144
  "filename": "packages/console/lib/trierarch-plugin-actions.ts"
145
145
  },
146
- "40728d0081ad5bb7ecfb09e5e81d3c34f2f7519f01": {
146
+ "40310eb6bdeab2e8785467b72d62b51792c764c228": {
147
147
  "workers": {
148
148
  "app/(console)/fleet-health/[cause]/page": {
149
149
  "moduleId": 752012,