Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support running via eval/require as well as vm2 #378

Merged
merged 10 commits into from
Oct 15, 2017
Merged

Support running via eval/require as well as vm2 #378

merged 10 commits into from
Oct 15, 2017

Conversation

orta
Copy link
Member

@orta orta commented Sep 19, 2017

Gets relative paths working correctly via vm2 - deprecates #359

Updates us to a vm2 which has an index.d.ts shipped patriksimek/vm2#92

Also makes the dangerfile use the custom tsconfig - which means it gets the include function.

@DangerCI
Copy link

DangerCI commented Sep 19, 2017

New dependencies added: require-from-string.

require-from-string

Author: Vsevolod Strukchinsky

Description: Require module from string

Homepage: https://github.com/floatdrop/require-from-string#readme

Createdabout 2 years ago
Last Updated28 days ago
LicenseMIT
Maintainers1
Releases8
Direct Dependencies
README

require-from-string Build Status

Load module from string in Node.

Install

$ npm install --save require-from-string

Usage

var requireFromString = require('require-from-string');

requireFromString('module.exports = 1');
//=> 1

API

requireFromString(code, [filename], [options])

code

Required
Type: string

Module code.

filename

Type: string
Default: ''

Optional filename.

options

Type: object

appendPaths

Type: Array

List of paths, that will be appended to module paths. Useful, when you want
to be able require modules from these paths.

prependPaths

Type: Array

Same as appendPath, but paths will be prepended.

License

MIT © Vsevolod Strukchinsky

yarn why require-from-string output

  • Has been hoisted to "require-from-string"
  • This module exists because it's specified in "dependencies".
  • Disk size without dependencies: "16kB"
  • Disk size with unique dependencies: "16kB"
  • Disk size with transitive dependencies: "16kB"
  • Number of shared dependencies: 0

Generated by 🚫 dangerJS

@orta orta force-pushed the vm_tighten branch 2 times, most recently from 2736b8d to 65bb087 Compare September 19, 2017 15:52
@orta
Copy link
Member Author

orta commented Sep 21, 2017

I was testing by using ts-node, which I bet was pre-compiling it in some form for me, will need to test this by using the built versions. Can't write a test with Jest either as it will compile also. 🍡

@orta
Copy link
Member Author

orta commented Oct 14, 2017

OK, I have a clue

screen shot 2017-10-14 at 12 15 30 pm

When running via the eval, the file for which all relative imports are working from is of course the runner. Not the cwd for the dangerfile.

@orta orta changed the title Handle relative path resolving Support running via eval/require as well as vm2 Oct 15, 2017
@orta orta merged commit a9d2691 into master Oct 15, 2017
@orta orta deleted the vm_tighten branch October 15, 2017 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants