Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-amd-wrap

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-amd-wrap

![Language](https://img.shields.io/badge/-TypeScript-blue.svg) [![Build Status](https://travis-ci.org/searchfe/gulp-amd-wrap.svg?branch=master)](https://travis-ci.org/searchfe/gulp-amd-wrap) [![Coveralls](https://img.shields.io/coveralls/searchfe/gulp-amd

  • 1.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by600%
Maintainers
1
Weekly downloads
 
Created
Source

gulp-amd-wrap

Language Build Status Coveralls npm package npm downloads semantic-release

gulp-amd-wrap是一个分析amd模块,并进行预编译处理的的gulp插件,主要完成根据依赖分析及项目路径生成模块声明及引用的moduleID,并封装成amd规范的模块。

Install

npm i gulp-amd-wrap --save-dev

Example

import { amdWrap } from 'gulp-amd-wrap';

gulp.src(
  // 资源
  `${__dirname}\/assert/*.js`, {
      // 工程baseUrl
      base: __dirname,
    },
).pipe(amdWrap({
  baseUrl: '/assert/',
  prefix: 'wiseindex/',
  // 不参与amd-hook分析的文件
  exelude: ['/exclude-**.js', '/dist/**'],
  moduleID: {
    'moduleID': 'filepath'
  }
})).pipe(
  gulp.dest(`${__dirname}\/dist\/`),
);

// Before
define(function() {
  'use strict';

  var fishObj = {
    name: 'nimo'
  };
  var moduleA = require('@scope/moduleA');
  var moduleB = require('./moduleB');

  require(['A', './B', '/C', '@D/E'], function(a, b, c, d){
    console.log(a, b, c, d);
  });

  return fishObj;

});

// After
define('assert/minify-define', [
    'require',
    '@scope/moduleA',
    'assert/moduleB'
], function (require, moduleA, moduleB) {
    'use strict';
    var fishObj = { name: 'nimo' };
    require([
        'A',
        'assert/B',
        '/C',
        '@D/E'
    ], function (a, b, c, d) {
        console.log(a, b, c, d);
    });
    return fishObj;
});

API

API DOC

FAQs

Package last updated on 29 Jul 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc