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

gulp-amd-wrap

Package Overview
Dependencies
Maintainers
8
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-amd-wrap - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

25

CHANGELOG.md

@@ -1,2 +0,2 @@

## [1.0.7](https://github.com/searchfe/gulp-amd-wrap/compare/v1.0.6...v1.0.7) (2019-07-29)
## [1.0.10](https://github.com/searchfe/gulp-amd-wrap/compare/v1.0.9...v1.0.10) (2019-09-19)

@@ -6,2 +6,24 @@

* support require dynamic module ([e5836ac](https://github.com/searchfe/gulp-amd-wrap/commit/e5836ac))
* support require dynamic module ([ac4eb0c](https://github.com/searchfe/gulp-amd-wrap/commit/ac4eb0c))
## [1.0.9](https://github.com/searchfe/gulp-amd-wrap/compare/v1.0.8...v1.0.9) (2019-09-19)
### Bug Fixes
* support require dynamic module ([0bc28e4](https://github.com/searchfe/gulp-amd-wrap/commit/0bc28e4))
* support require dynamic module ([38d0349](https://github.com/searchfe/gulp-amd-wrap/commit/38d0349))
## [1.0.8](https://github.com/searchfe/gulp-amd-wrap/compare/v1.0.7...v1.0.8) (2019-09-19)
### Bug Fixes
* support require dynamic module ([1e37860](https://github.com/searchfe/gulp-amd-wrap/commit/1e37860))
## [1.0.7](https://github.com/searchfe/gulp-amd-wrap/compare/v1.0.6...v1.0.7) (2019-07-29)
### Bug Fixes
* no elements in parser ([46823b3](https://github.com/searchfe/gulp-amd-wrap/commit/46823b3))

@@ -26,5 +48,4 @@

### Bug Fixes
* fix semantic config bug ([fb75b9e](https://github.com/searchfe/gulp-amd-wrap/commit/fb75b9e))

11

dist/async-analyzer.js

@@ -6,4 +6,4 @@ "use strict";

* @Date: 2019-04-27 14:21:32
* @Last Modified by: liangjiaying@baidu.com
* @Last Modified time: 2019-08-20 15:29:21
* @Last Modified by: qiansc
* @Last Modified time: 2019-09-19 17:47:04
*/

@@ -32,4 +32,7 @@ var estraverse_1 = require("estraverse");

node.arguments[0].elements.forEach(function (element, index) {
element.value = moduleID.parseBase(_this.baseUrl || _this.cwd, moduleID.parseAbsolute(_this.cwd, element.value));
delete element.raw;
/** 如果是动态require就不会有value require(mod) */
if (element.value) {
element.value = moduleID.parseBase(_this.baseUrl || _this.cwd, moduleID.parseAbsolute(_this.cwd, element.value));
delete element.raw;
}
});

@@ -36,0 +39,0 @@ }

@@ -16,4 +16,2 @@ export declare function amdWrap(option: IAmdWrap): any;

anonymousModule?: string[];
/** 生成的ModuleId 是否需要md5后缀来避免其他模块引用 如 @molecule/toptip2_134dfas */
useMd5?: any;
}

@@ -20,0 +18,0 @@ interface IAmdWrapCustomOption {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var stream = require("readable-stream");
var filter_1 = require("./filter");
var parser_1 = require("./parser");
var stream = require("readable-stream");
var Transform = stream.Transform;

@@ -14,4 +14,2 @@ function amdWrap(option) {

var prefix = option.prefix || '';
var useMd5 = option.useMd5 || false;
// let location = parseBase(file.path);
if (filter_1.include(file.path, option.exclude, option.baseUrl)) {

@@ -26,3 +24,2 @@ // 在exlude名单中 do nothing

removeModuleId: filter_1.include(file.path, option.anonymousModule, option.baseUrl),
useMd5: useMd5,
});

@@ -29,0 +26,0 @@ file.contents = new Buffer(parser.getContent());

export { amdWrap } from './hook';
export { absolutize } from './absolutize';
export { addRequireConfig } from './addRequireConfig';

@@ -5,4 +5,4 @@ "use strict";

* @Date: 2019-04-23 11:18:08
* @Last Modified by: liangjiaying@baidu.com
* @Last Modified time: 2019-08-08 19:20:06
* @Last Modified by: qiansc
* @Last Modified time: 2019-06-05 17:33:33
*/

@@ -14,3 +14,1 @@ Object.defineProperty(exports, "__esModule", { value: true });

exports.absolutize = absolutize_1.absolutize;
var addRequireConfig_1 = require("./addRequireConfig");
exports.addRequireConfig = addRequireConfig_1.addRequireConfig;

@@ -21,4 +21,3 @@ /// <reference types="node" />

removeModuleId?: boolean;
useMd5?: any;
}
export {};

@@ -6,4 +6,4 @@ "use strict";

* @Date: 2019-04-28 14:43:21
* @Last Modified by: liangjiaying@baidu.com
* @Last Modified time: 2019-08-20 15:53:56
* @Last Modified by: qiansc
* @Last Modified time: 2019-06-05 10:45:51
*/

@@ -13,9 +13,6 @@ var escodegen_1 = require("escodegen");

var estraverse_1 = require("estraverse");
var fs_1 = require("fs");
var path_1 = require("path");
var async_analyzer_1 = require("./async-analyzer");
var dependency_analyzer_1 = require("./dependency-analyzer");
var filter_1 = require("./filter");
var moduleID_1 = require("./moduleID");
var md5File = require('md5-file');
var Parser = /** @class */ (function () {

@@ -45,16 +42,2 @@ function Parser(contents, filePath, root, prefix) {

if (hookOption === void 0) { hookOption = {}; }
/** 生成的ModuleId md5后缀来避免其他模块引用 @molecule/toptip2_134dfas */
var md5Value = '';
if (hookOption.useMd5 === true || hookOption.useMd5 && hookOption.useMd5.useMd5) {
var exlude = hookOption.useMd5.exlude; // 要被排除的文件
if (!filter_1.include(path_1.resolve(this.filePath), exlude, this.root)) {
// 不在md5排除名单中
try {
md5Value = '_' + md5File.sync(this.filePath.replace('.js', '.ts')).slice(0, 7);
}
catch (e) {
console.log(e);
}
}
}
// console.log(this.contents.toString());

@@ -71,5 +54,5 @@ estraverse_1.traverse(this.ast, {

}
// 首参数推入moduleId => define("@molecule/toptip/main",xxxx)
// 首参数是依赖数组,推入moduleId
if (node.arguments[0].type === 'ArrayExpression') {
node.arguments.unshift({ type: 'Literal', value: moduleID_1.parseBase(_this.root, _this.filePath, _this.prefix) + md5Value });
node.arguments.unshift({ type: 'Literal', value: moduleID_1.parseBase(_this.root, _this.filePath, _this.prefix) });
}

@@ -81,16 +64,2 @@ var analyzer = new dependency_analyzer_1.DependencyAnalyzer(_this.cwd, node, _this.root);

});
// 第二参数是依赖数组 => define("", ['require', 'exports', 'md5-file'])
if (node.arguments[1].elements) {
node.arguments[1].elements.forEach(function (element, index) {
var valueString = element.value;
/** depPath: 实际依赖的相对路径文件。如果是node_module就为空 */
var depPath = moduleID_1.parseAbsolute(path_1.dirname(_this.filePath), valueString + '.ts');
if (fs_1.existsSync(depPath)) {
var md5 = '_' + md5File.sync(depPath).slice(0, 7);
// moduleid 示例:@molecule/toptip/main_dc85e717d6352fa285bc70bc2d1d3595
var moduleid = moduleID_1.parseBase(_this.root, depPath, _this.prefix) + md5;
node.arguments[1].elements[index].value = moduleid;
}
});
}
if (node.arguments[1] && !_this.isHasObj(node.arguments[1].elements, 'require')) {

@@ -97,0 +66,0 @@ node.arguments[1].elements.push({ type: 'Literal', value: 'require' });

{
"name": "gulp-amd-wrap",
"version": "1.0.9",
"version": "1.0.10",
"discription": "gulp-amd-wrap",

@@ -85,3 +85,2 @@ "scripts": {

"estraverse": "^4.2.0",
"md5-file": "^4.0.0",
"minimatch": "^3.0.4",

@@ -88,0 +87,0 @@ "readable-stream": "^3.3.0"

@@ -17,4 +17,3 @@ {

"no-var-requires": false,
"quotemark": [true, "single"],
"ordered-imports": false
"quotemark": [true, "single"]
// "use-input-property-decorator": true,

@@ -25,2 +24,3 @@ // "use-output-property-decorator": true,

// "max-classes-per-file": false,
// "ordered-imports": false,
// "variable-name": false,

@@ -27,0 +27,0 @@ // "prefer-const": false,

Sorry, the diff of this file is too big to display

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