5.12.127 • Published 10 months ago

@patrtorg/ducimus-magni-quibusdam v5.12.127

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

About

@patrtorg/ducimus-magni-quibusdam.js implements a CommonJS-style module system for NodeJS which has a high degree of compatibility with the default module system, npm, etc -- but which exists in a separate vm context and not share an exports object graph, cache, etc, with the default module system.

Raison d'Etre

This library was created so that we could run unit tests of client-server architecture libraries which have namespace collisions and are intended to operate as singletons. Rather than making our tests rely on starting/stopping external daemons, we create the daemon in the test and connect to it from the same client. This also lets us deeply inspect the state of both components during a test, and step through both sides of a conversation with a single debugger.

This module system is sufficiently complete to load Distributive's dcp-client library, which has signficant dependencies and tinkers with module filename resolution.

Unsupported Features

  • ESMs (undefined behaviour)

Supported Features

  • CommonJS Modules/1.1.1
  • return exports idiom
  • module.exports re-assignment
  • filename, dirname
  • require.main
  • require.extensions
  • node_modules / package.json / index.js
  • JSON modules (.json)
  • NAPI modules (.node)
  • MODULE_NOT_FOUND error code
  • module module with a Module class with limited support for userland manipulation of _resolveFilename, _cache, etc.
  • Monkey-patched vm module so that "this context" refers to CtxModule's contextLoad node modules into an alternate context

API

CtxModule(ctx, cnId, moduleCache, parent)

CtxModule constructor; creates a new module.

ctx

the context object in which the module will be created

cnId

optional string which is the canonical module id (usually filename) of the module. This parameter must be a filename for any module which wants to use require for relative-named modules.

moduleCache

optional per-ctx object which holds loaded modules, or strings which hold the filenames where the source code for the module is located. This parameter is necessary for any module which wants to use require. Properties of this object are either search-path or canonical module identifiers.

parent

optional object which is an instanceof CtxModule or a CtxModule-duck which at least has a require method.

makeNodeProgramContext

Factory function which creates a fresh context suitable for running NodeJS programs. Default modules such as fs, os, vm, path, process, tty, etc, are linked from the calling context.

contextName

optional string which specifies the name of the context

moreModules

optional object shaped like moduleCache which can inject modules from the outer context. Each property name is either the canonical module identifier (usually a rooted pathname) or a search-path module identifier (eg "path"). Each property must be either a string containing the module's filename, or an object containing the module's exports.

Example

const vm = require('vm');
const ctx = require('@patrtorg/ducimus-magni-quibusdam').makeNodeProgramContext();

vm.runInContext('require("dcp-client").init()', ctx).then(console.log('initialized dcp-client'));

Author

Wes Garland, Distributive Corp.

LICENSE

Released under the terms of the MIT License; see LICENSE file.

getoptoutputcorecodesUint32Arraydatastructureregular expression.envtrimshellclonesearchimportexportebstesterArray.prototype.flatdayjsflattakeequaliteratortoobjectimportec2flattenURLSearchParamsassertnamesparsercall-boundsymlinksflatMapi18nbcryptstoragegatewaytyped arraywgetjapanesemimetypeslookFloat32Arrayreact-testing-librarygroupcryptoschemaredirecthookspipe0ECMAScript 2020fsurlindicatorexpressObject.keysfiltertaskmodulesString.prototype.trimconfigurabledatequerystringio-tschaiglobargsdynamodbsortlanguagelocationcoerciblereadablefind-upReactiveExtensionscollectionsafereducerreadablestreamless mixinsauthUint16ArraycharactersargumentstructuredClone-0isConcatSpreadableargvboundenumerableajaxdiridlefindLastIndexRegExp#flagshas-owncloudfrontcommanderfast-clonecommandrateArray.prototype.findLastnested cssredux-toolkitcorsTypeScriptgetterbreakRegExp.prototype.flagsvestprotobufcallbackspinnerssymbolses7stylingbrowserhasOwnslotbundlingwhichparentsassertsmatchHyBiopencolorsloggingnegative zerohelpersInt32ArraypackageObject.isArrayframeworkAsyncIteratorincompilerroutestdlibArrayBuffer#slicegetdataViewpathBigInt64Arraypromiseformerrorimmerextendtypeofdependency managerES3ESdebugfastcopyless cssweaksetlivejsdiffprefixunicodelogpersistentstyleses8negativeperformancefastifyUint8ClampedArrayES2017real-timeObjectremoveelmES2020ES2018ES2023loggers3fpsperformanthasfseventstestingECMAScript 2022es2018quotejsxinspecthttpoffsetqueryclassnamesqshookformclassesES2022everyestreegraphqlobjvisualjQuerypatchlessrequirewatcherxtermfast-copymime-dbReflect.getPrototypeOfeslintplugindataWeakMaptestcloudwatchsymlinkvaluepackage.jsonfast-deep-copyexpressionforEachtapartassertionjsonpathdeep-cloneprototypeenvironmentairbnbcjkjwtutilitiesroutingoptimistequalitysequencecachefindprivateWebSocketsyntaxerrorswfslicetypesafeemojiproxylistenersformsdebuggermoveemreslinttostringtagchromiumcircularmapasciiomitfast-deep-cloneelasticachePushparseauthenticationwidthrm -frdefinePropertyidformattingES2015predictablechromesimpledbtypeerrorURLstyleguidedeepclonemergemrupasswordexecStreamfetchpreprocessordescriptionisfunctionlastECMAScript 2023writeoptiontrimStartfull-widthECMAScript 2015Array.prototype.filterlazyawesomesaucefastclonesharedarraybufferECMAScript 7ES2019asyncentriesuuidconsolecalles-abstracteventDispatchertrimEndBigUint64ArrayUint8ArrayfastbindObject.getPrototypeOfcode pointspostcss-pluginschemestatelessIteratorSymbol.toStringTagconcatpreserve-symlinksttyescapeconcurrencybundlerflagECMAScript 2017class-validatorqueueMicrotaskkeysendpointshebangdescriptorsES6setterspinnerbyteOffsetownbrowserslistECMAScript 6dom-testing-librarykoreannodejsextensionrfc4122higher-orderiamArrayBufferlimitedvalidationcore-jsArrayBuffer.prototype.slicecolortelephonewatchinges-shimsmodulepolyfillfile systemrmdirmatchAllpropertygradients cssinputguidaccessorcallboundWeakSetcss lessvalidatestringifytsworkspace:*JSONtrimRightloadingbytenodelibphonenumberdescriptorECMAScript 2019Object.fromEntriesclientwrapcloudformationlength
@patrtorg/numquam-doloribus-sit@patrtorg/doloribus-aperiam@patrtorg/dolorum-blanditiis@patrtorg/dolorum-quisquam-molestias@patrtorg/eaque-tempore-temporibus@patrtorg/ducimus-hic@patrtorg/eaque-dolorem-iusto@patrtorg/enim-culpa@patrtorg/enim-quas@patrtorg/est-corrupti@patrtorg/error-expedita-rerum@patrtorg/esse-ut@patrtorg/esse-occaecati-quos@patrtorg/ex-iure@patrtorg/expedita-deleniti-ratione@patrtorg/expedita-eaque-at@patrtorg/fugiat-beatae-quas@patrtorg/fugiat-perspiciatis@patrtorg/fugit-cumque@patrtorg/illo-saepe@patrtorg/hic-facere-ratione@patrtorg/itaque-beatae@patrtorg/iste-sunt@patrtorg/iure-at@patrtorg/labore-nemo-impedit@patrtorg/magnam-aut-adipisci@patrtorg/molestiae-nulla-architecto@patrtorg/modi-aut-dolorem@patrtorg/modi-officia-iusto@patrtorg/nihil-at@patrtorg/nihil-vero-ipsa@patrtorg/pariatur-sapiente@patrtorg/quia-laborum-porro@patrtorg/qui-dolore@patrtorg/quidem-dolore@patrtorg/qui-omnis-voluptates@patrtorg/similique-nam@patrtorg/sed-laudantium-nemo@patrtorg/sapiente-sed-eius@patrtorg/sed-veritatis-placeat@patrtorg/soluta-quo@patrtorg/nisi-perferendis@patrtorg/perspiciatis-possimus@patrtorg/quo-cupiditate-sit@patrtorg/saepe-tenetur-iusto@patrtorg/repellendus-ex@patrtorg/repudiandae-dolore@patrtorg/repellat-quam@patrtorg/tempora-quas@patrtorg/tempore-cumque@patrtorg/vero-quibusdam-ipsa@patrtorg/maiores-adipisci-maxime@patrtorg/nostrum-beatae-a@patrtorg/nobis-assumenda-optio@patrtorg/nobis-nobis@patrtorg/quas-sed-id@patrtorg/reiciendis-doloribus-officia@patrtorg/soluta-numquam@patrtorg/soluta-et@patrtorg/neque-consectetur@patrtorg/neque-voluptatem@patrtorg/odit-facere@patrtorg/officiis-qui@patrtorg/odio-ratione@patrtorg/officiis-dolorum@patrtorg/quos-hic@patrtorg/similique-vero-sapiente@patrtorg/sit-ipsam-dolore@patrtorg/suscipit-sit-culpa@patrtorg/tempora-impedit-dolore@patrtorg/porro-voluptates@patrtorg/quod-asperiores@patrtorg/tenetur-aut@patrtorg/tempore-labore-mollitia@patrtorg/totam-accusamus@patrtorg/veritatis-vel-amet@patrtorg/veritatis-ad-voluptates@patrtorg/occaecati-reiciendis-reiciendis@patrtorg/pariatur-repellendus-aspernatur@patrtorg/quo-in@patrtorg/sunt-distinctio-illo@patrtorg/sunt-asperiores@patrtorg/ullam-eum@patrtorg/ullam-doloremque@patrtorg/unde-cupiditate@patrtorg/animi-laboriosam-adipisci@patrtorg/aperiam-quaerat@patrtorg/aspernatur-assumenda@patrtorg/aspernatur-dolorum-ducimus@patrtorg/architecto-laudantium@patrtorg/aspernatur-repellendus-assumenda@patrtorg/assumenda-officia@patrtorg/assumenda-qui@patrtorg/assumenda-ipsam@patrtorg/aspernatur-laborum@patrtorg/at-sunt-itaque@patrtorg/commodi-illo@patrtorg/beatae-quas@patrtorg/blanditiis-ea-quaerat@patrtorg/blanditiis-quibusdam-sit
5.12.127

10 months ago

5.12.126

10 months ago

3.2.24

1 year ago

3.2.23

1 year ago

3.2.26

1 year ago

3.2.25

1 year ago

5.6.91

11 months ago

3.2.28

1 year ago

5.6.90

11 months ago

3.2.27

1 year ago

5.6.93

11 months ago

5.6.92

11 months ago

3.2.29

1 year ago

5.10.116

10 months ago

3.2.20

1 year ago

3.2.22

1 year ago

3.2.21

1 year ago

4.3.53

1 year ago

4.3.52

1 year ago

4.3.51

1 year ago

4.3.50

1 year ago

5.6.84

11 months ago

3.2.35

1 year ago

5.6.83

12 months ago

3.2.34

1 year ago

5.6.86

11 months ago

3.2.37

1 year ago

5.6.85

11 months ago

3.2.36

1 year ago

5.6.80

12 months ago

3.2.39

1 year ago

3.2.38

1 year ago

5.6.82

12 months ago

5.6.81

12 months ago

5.12.119

10 months ago

5.12.118

10 months ago

3.2.31

1 year ago

3.2.30

1 year ago

3.2.33

1 year ago

3.2.32

1 year ago

5.12.124

10 months ago

4.3.42

1 year ago

5.12.123

10 months ago

4.3.41

1 year ago

5.12.122

10 months ago

4.3.40

1 year ago

5.12.121

10 months ago

5.12.120

10 months ago

5.10.115

10 months ago

4.3.46

1 year ago

5.10.114

10 months ago

4.3.45

1 year ago

5.10.113

10 months ago

4.3.44

1 year ago

5.10.112

10 months ago

4.3.43

1 year ago

4.3.49

1 year ago

4.3.48

1 year ago

4.3.47

1 year ago

5.6.88

11 months ago

1.2.16

1 year ago

5.6.87

11 months ago

1.2.17

1 year ago

1.2.14

1 year ago

5.6.89

11 months ago

1.2.15

1 year ago

5.6.73

12 months ago

5.6.72

12 months ago

5.6.75

12 months ago

5.6.74

12 months ago

5.6.71

12 months ago

5.6.70

12 months ago

5.12.125

10 months ago

5.9.109

11 months ago

5.9.106

11 months ago

5.9.105

11 months ago

5.9.108

11 months ago

5.9.107

11 months ago

5.9.104

11 months ago

5.4.56

1 year ago

5.9.103

11 months ago

5.4.57

1 year ago

5.6.77

12 months ago

5.4.54

1 year ago

5.6.76

12 months ago

5.4.55

1 year ago

5.6.79

12 months ago

5.6.78

12 months ago

5.4.53

1 year ago

5.9.112

10 months ago

5.6.69

12 months ago

5.7.100

11 months ago

5.6.66

12 months ago

5.6.65

12 months ago

5.9.111

10 months ago

5.6.68

12 months ago

5.9.110

11 months ago

5.6.67

12 months ago

3.3.39

1 year ago

2.2.17

1 year ago

2.2.18

1 year ago

5.7.96

11 months ago

5.7.95

11 months ago

5.7.98

11 months ago

5.7.97

11 months ago

5.7.94

11 months ago

5.7.93

11 months ago

3.3.40

1 year ago

2.2.19

1 year ago

2.2.20

1 year ago

5.11.116

10 months ago

5.7.99

11 months ago

5.3.53

1 year ago

5.11.118

10 months ago

5.11.117

10 months ago

5.5.62

1 year ago

5.5.63

1 year ago

5.5.60

1 year ago

5.5.61

1 year ago

5.5.64

1 year ago

5.5.65

12 months ago

5.8.102

11 months ago

5.8.103

11 months ago

5.8.100

11 months ago

5.8.101

11 months ago

5.5.59

1 year ago

5.5.57

1 year ago

5.5.58

1 year ago

1.2.13

1 year ago

1.2.9

1 year ago

1.2.12

1 year ago

1.2.10

1 year ago

1.2.11

1 year ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago