Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • S sweet-core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 62
    • Issues 62
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • sweet-js
  • sweet-core
  • Merge requests
  • !227

Localize require

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/andreypopp/local-require into master Jan 29, 2014
  • Overview 19
  • Commits 1
  • Pipelines 0
  • Changes 7

Created by: andreypopp

Make require inside scopedEval to resolve modules againt current module's filename. This way we can require functions from other modules.

Allows to do require(...) calls inside macro bodies:

macro sql {
  case { _ $expr:expr } => {
    var parser = require('sql-parser');
    return parser.parse(#{$expr}.token.value);
  } 
}

This is very useful when you want to embed some other language inside JS (via ES6 tagged template strings for example), see sweet-jsx or sweet-sql for example.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/andreypopp/local-require