🚀 Launch Week Day 5:Introducing Immutable Scans.Learn More →
Socket
Book a DemoInstallSign in
Socket

glov-build-preresolve

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glov-build-preresolve

Sub-module path resolving task processor for glov-build

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

Sub-module path resolving task processor for glov-build

By default, resolves any 'glov/foo.js' strings to appropriate relative paths assuming glov is located in the root of the source. This is useful if you have a fork of GLOV.js or similar framework inside your project and want your code to be able to reference the module in the standard node module syntax without messing around with modifying each of Node/Browserify/WebPack/etc's module search paths/mechanisms. To maintain compatibility with IDEs and other tooling, this may be best used in conjunction with adding a local file path module to your package.json (npm will then also create a symlink to the module within node_modules).

Example package.json entry:

{
  "devDependencies": {
    "glov": "file:./src/glov"
  }
}

API usage:

const preresolve = require('glov-build-preresolve');

gb.task({
  name: ...,
  ...preresolve(options),
});

Options

  • source - optional input source task. This is used as a source for looking for matching paths and for sourcing inputs to this task. Expected usage it to source another task that is outputting .js and .map files. Default: 'source'.
  • modules - optional map from module name to local path within the source. Default:
{
  'glov': 'glov',
}
  • filter - optional RegExp to filter which files get processed and which get passed through. Default: /\.js$/.

Example usage:

const gb = require('glov-build');
const preresolve = require('glov-build-preresolve');

gb.configure({
  source: 'src',
  statedir: 'out/.gbstate',
  targets: {
    dev: 'out',
  },
});

gb.task({
  name: 'preresovle_glov',
  ...preresolve(),
});

gb.task({
  name: 'preresolve_common'
  target: 'dev',
  ...preresolve({
    source: 'preresovle_glov',
    modules: {
      common: 'common',
    },
  }),
});

Example input in a fork of a GLOV.js project, which also contains a src/common/mything.js.

// src/client/foo/bar.js
const foo = require('glov/client/engine.js');
const bar = require('glov/common/util.js');
const baz = require('common/mything.js');

Example output:

const foo = require('../../glov/client/engine.js');
const bar = require('../../glov/common/util.js');
const baz = require('../../common/mything.js');

Keywords

glov-build

FAQs

Package last updated on 19 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts