@pulumi/pulumi 3.150.1-alpha.x425a5d7 → 3.150.1-alpha.x471f1af
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.
- package/package.json +1 -1
- package/provider/experimental/analyzer.d.ts +0 -3
- package/provider/experimental/analyzer.js +0 -35
- package/provider/experimental/analyzer.js.map +1 -1
- package/provider/experimental/provider.d.ts +0 -14
- package/provider/experimental/provider.js +3 -31
- package/provider/experimental/provider.js.map +1 -1
- package/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ComponentResource } from "../../resource";
|
|
2
1
|
export declare type ComponentDefinition = {
|
|
3
2
|
name: string;
|
|
4
3
|
};
|
|
@@ -10,14 +9,12 @@ export declare type AnalyzeResult = {
|
|
|
10
9
|
typeDefinitons: Record<string, TypeDefinition>;
|
|
11
10
|
};
|
|
12
11
|
export declare class Analyzer {
|
|
13
|
-
private path;
|
|
14
12
|
private checker;
|
|
15
13
|
private program;
|
|
16
14
|
private components;
|
|
17
15
|
private typeDefinitons;
|
|
18
16
|
constructor(dir: string);
|
|
19
17
|
analyze(): AnalyzeResult;
|
|
20
|
-
findComponent(name: string): Promise<typeof ComponentResource>;
|
|
21
18
|
private analyseFile;
|
|
22
19
|
private isPulumiComponent;
|
|
23
20
|
}
|
|
@@ -12,15 +12,6 @@
|
|
|
12
12
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
// See the License for the specific language governing permissions and
|
|
14
14
|
// limitations under the License.
|
|
15
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
17
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
18
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
19
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
20
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
21
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
15
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
16
|
if (mod && mod.__esModule) return mod;
|
|
26
17
|
var result = {};
|
|
@@ -44,7 +35,6 @@ class Analyzer {
|
|
|
44
35
|
const configPath = `${dir}/tsconfig.json`;
|
|
45
36
|
const config = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
46
37
|
const parsedConfig = ts.parseJsonConfigFileContent(config.config, ts.sys, path.dirname(configPath));
|
|
47
|
-
this.path = dir;
|
|
48
38
|
this.program = ts.createProgram({
|
|
49
39
|
rootNames: parsedConfig.fileNames,
|
|
50
40
|
options: parsedConfig.options,
|
|
@@ -64,31 +54,6 @@ class Analyzer {
|
|
|
64
54
|
typeDefinitons: this.typeDefinitons,
|
|
65
55
|
};
|
|
66
56
|
}
|
|
67
|
-
findComponent(name) {
|
|
68
|
-
var _a;
|
|
69
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const sourceFiles = this.program.getSourceFiles();
|
|
71
|
-
for (const sourceFile of sourceFiles) {
|
|
72
|
-
if (sourceFile.fileName.includes("node_modules") || sourceFile.fileName.endsWith(".d.ts")) {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
for (const node of sourceFile.statements) {
|
|
76
|
-
if (ts.isClassDeclaration(node) && this.isPulumiComponent(node) && node.name) {
|
|
77
|
-
if (ts.isClassDeclaration(node) && this.isPulumiComponent(node) && ((_a = node.name) === null || _a === void 0 ? void 0 : _a.text) === name) {
|
|
78
|
-
try {
|
|
79
|
-
const module = yield Promise.resolve().then(() => __importStar(require(sourceFile.fileName)));
|
|
80
|
-
return module[name];
|
|
81
|
-
}
|
|
82
|
-
catch (e) {
|
|
83
|
-
throw new Error(`Failed to import component '${name}': ${e}`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
throw new Error(`Component '${name}' not found`);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
57
|
analyseFile(sourceFile) {
|
|
93
58
|
// We intentionally visit only the top-level nodes, because we only
|
|
94
59
|
// support components defined at the top-level. We have no way to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.js","sourceRoot":"","sources":["../../../provider/experimental/analyzer.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC
|
|
1
|
+
{"version":3,"file":"analyzer.js","sourceRoot":"","sources":["../../../provider/experimental/analyzer.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;;;;;;;AAKjC,2CAA6B;AAE7B,+EAA+E;AAC/E,+CAA+C;AAC/C,4EAA4E;AAC5E,wEAAwE;AACxE,wEAAwE;AACxE,gDAAgD;AAChD,MAAM,EAAE,GAAsB,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAe/D,MAAa,QAAQ;IAMjB,YAAY,GAAW;QAHf,eAAU,GAAwC,EAAE,CAAC;QACrD,mBAAc,GAAmC,EAAE,CAAC;QAGxD,MAAM,UAAU,GAAG,GAAG,GAAG,gBAAgB,CAAC;QAC1C,MAAM,MAAM,GAAG,EAAE,CAAC,cAAc,CAAC,UAAU,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9D,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IAEO,iBAAiB,CAAC,IAAiC;QACvD,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YACvB,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACxC,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE;;gBACpC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;gBACxD,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;gBAChC,MAAM,WAAW,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,MAAK,mBAAmB,CAAC;gBAChE,MAAM,UAAU,SAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,0CAAG,CAAC,EAAE,aAAa,EAAE,CAAC;gBAC7D,MAAM,iBAAiB,GACnB,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,CAAC,QAAQ,CAAC,aAAa,OAAK,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,CAAC,QAAQ,CAAC,eAAe,EAAC,CAAC;gBACnG,OAAO,WAAW,IAAI,iBAAiB,CAAC;YAC5C,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AA9DD,4BA8DC"}
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
import { ComponentResourceOptions } from "../../resource";
|
|
2
|
-
import { ConstructResult, Provider } from "../provider";
|
|
3
|
-
import { Inputs } from "../../output";
|
|
4
|
-
export declare class ComponentProvider implements Provider {
|
|
5
|
-
readonly dir: string;
|
|
6
|
-
private packageJSON;
|
|
7
|
-
private path;
|
|
8
|
-
private analyzer;
|
|
9
|
-
version: string;
|
|
10
|
-
static validateResourceType(packageName: string, resourceType: string): void;
|
|
11
|
-
constructor(dir: string);
|
|
12
|
-
getSchema(): Promise<string>;
|
|
13
|
-
construct(name: string, type: string, inputs: Inputs, options: ComponentResourceOptions): Promise<ConstructResult>;
|
|
14
|
-
}
|
|
15
1
|
export declare function componentProviderHost(dirname?: string): Promise<void>;
|
|
@@ -42,49 +42,21 @@ class ComponentProvider {
|
|
|
42
42
|
this.packageJSON = JSON.parse(packStr);
|
|
43
43
|
this.version = this.packageJSON.version;
|
|
44
44
|
this.path = absDir;
|
|
45
|
-
this.analyzer = new analyzer_1.Analyzer(this.path);
|
|
46
|
-
}
|
|
47
|
-
static validateResourceType(packageName, resourceType) {
|
|
48
|
-
const parts = resourceType.split(":");
|
|
49
|
-
if (parts.length !== 3) {
|
|
50
|
-
throw new Error(`Invalid resource type ${resourceType}`);
|
|
51
|
-
}
|
|
52
|
-
if (parts[0] !== packageName) {
|
|
53
|
-
throw new Error(`Invalid package name ${parts[0]}, expected '${packageName}'`);
|
|
54
|
-
}
|
|
55
|
-
// We might want to relax this limitation, but for now we only support the "index" module.
|
|
56
|
-
if (parts[1] !== "index" && parts[1] !== "") {
|
|
57
|
-
throw new Error(`Invalid module '${parts[1]}' in resource type '${resourceType}', expected 'index' or empty string`);
|
|
58
|
-
}
|
|
59
|
-
if (parts[2].length === 0) {
|
|
60
|
-
throw new Error(`Empty resource name in resource type '${resourceType}'`);
|
|
61
|
-
}
|
|
62
45
|
}
|
|
63
46
|
getSchema() {
|
|
64
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
const
|
|
48
|
+
const analyzer = new analyzer_1.Analyzer(this.path);
|
|
49
|
+
const { components, typeDefinitons } = analyzer.analyze();
|
|
66
50
|
const schema = schema_1.generateSchema(this.packageJSON, components, typeDefinitons);
|
|
67
51
|
return JSON.stringify(schema);
|
|
68
52
|
});
|
|
69
53
|
}
|
|
70
54
|
construct(name, type, inputs, options) {
|
|
71
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
|
|
73
|
-
const componentName = type.split(":")[2];
|
|
74
|
-
const ComponentClass = yield this.analyzer.findComponent(componentName);
|
|
75
|
-
// The ComponentResource base class has a 4 argument constructor, but
|
|
76
|
-
// the user defined component has a 3 argument constructor without the
|
|
77
|
-
// typestring.
|
|
78
|
-
// @ts-ignore
|
|
79
|
-
const instance = new ComponentClass(name, inputs, options);
|
|
80
|
-
return {
|
|
81
|
-
urn: instance.urn,
|
|
82
|
-
state: {},
|
|
83
|
-
};
|
|
56
|
+
throw new Error("Not implemented");
|
|
84
57
|
});
|
|
85
58
|
}
|
|
86
59
|
}
|
|
87
|
-
exports.ComponentProvider = ComponentProvider;
|
|
88
60
|
function componentProviderHost(dirname) {
|
|
89
61
|
const args = process.argv.slice(2);
|
|
90
62
|
// If dirname is not provided, get it from the call stack
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../provider/experimental/provider.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;;;;;;;;;;;;;;;;AAEjC,2BAAkC;AAClC,2CAA6B;AAI7B,sCAAiC;AACjC,qCAA0C;AAC1C,yCAAsC;AAEtC,
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../provider/experimental/provider.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;;;;;;;;;;;;;;;;AAEjC,2BAAkC;AAClC,2CAA6B;AAI7B,sCAAiC;AACjC,qCAA0C;AAC1C,yCAAsC;AAEtC,MAAM,iBAAiB;IAKnB,YAA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CAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC1D,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,CAAC,GAAG;YACZ,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACpC;aAAM;YACH,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;SAC3D;KACJ;IAED,MAAM,IAAI,GAAG,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC5C,OAAO,aAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5B,CAAC;AAtBD,sDAsBC"}
|
package/version.js
CHANGED
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
// See the License for the specific language governing permissions and
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.version = "3.150.1-alpha.
|
|
16
|
+
exports.version = "3.150.1-alpha.x471f1af";
|
|
17
17
|
//# sourceMappingURL=version.js.map
|