corba.js 0.1.8 → 0.1.10
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/lib/idl/src/idl/cc/typeIDLtoCC.d.ts +6 -0
- package/lib/idl/src/idl/cc/typeIDLtoGIOPCC.d.ts +3 -0
- package/lib/idl/src/idl/cc/write-code.d.ts +2 -0
- package/lib/idl/src/idl/cc/write-interface.d.ts +5 -0
- package/lib/idl/src/idl/cc/write-skeleton.d.ts +2 -0
- package/lib/idl/src/idl/cc/write-stub.d.ts +2 -0
- package/lib/idl/src/idl/idl-lexer.d.ts +19 -0
- package/lib/idl/src/idl/idl-node.d.ts +102 -0
- package/lib/idl/src/idl/idl-parser.d.ts +3 -0
- package/lib/idl/src/idl/idl.d.ts +1 -0
- package/lib/idl/src/idl/ts/typeIDLtoGIOPTS.d.ts +3 -0
- package/lib/idl/src/idl/ts/typeIDLtoTS.d.ts +3 -0
- package/lib/idl/src/idl/ts/write-interface.d.ts +2 -0
- package/lib/idl/src/idl/ts/write-skeleton.d.ts +2 -0
- package/lib/idl/src/idl/ts/write-stub.d.ts +2 -0
- package/lib/idl/src/idl/ts/write-value.d.ts +2 -0
- package/lib/idl/src/idl/ts/write-valueimpl.d.ts +2 -0
- package/lib/idl/src/idl/ts/write-valuetype.d.ts +2 -0
- package/lib/idl/src/idl/util.d.ts +23 -0
- package/lib/idl/src/index.d.ts +5 -0
- package/lib/idl/src/net/browser.d.ts +7 -0
- package/lib/idl/src/net/index.d.ts +3 -0
- package/lib/idl/src/net/tcp.d.ts +11 -0
- package/lib/idl/src/net/tls.d.ts +24 -0
- package/lib/idl/src/net/ws.d.ts +44 -0
- package/lib/idl/src/orb/asn1.d.ts +48 -0
- package/lib/idl/src/orb/connection.d.ts +24 -0
- package/lib/idl/src/orb/giop.d.ts +283 -0
- package/lib/idl/src/orb/index.d.ts +3 -0
- package/lib/idl/src/orb/ior.d.ts +89 -0
- package/lib/idl/src/orb/orb.d.ts +143 -0
- package/lib/idl/src/orb/protocol.d.ts +6 -0
- package/lib/idl/src/orb/uint8map.d.ts +14 -0
- package/lib/idl/src/orb/url.d.ts +55 -0
- package/lib/src/idl/cc/typeIDLtoCC.d.ts +6 -0
- package/lib/src/idl/cc/typeIDLtoCC.js +127 -0
- package/lib/src/idl/cc/typeIDLtoCC.js.map +1 -0
- package/lib/src/idl/cc/typeIDLtoGIOPCC.d.ts +3 -0
- package/lib/src/idl/cc/typeIDLtoGIOPCC.js +127 -0
- package/lib/src/idl/cc/typeIDLtoGIOPCC.js.map +1 -0
- package/lib/src/idl/cc/write-code.d.ts +2 -0
- package/lib/src/idl/cc/write-code.js +213 -0
- package/lib/src/idl/cc/write-code.js.map +1 -0
- package/lib/src/idl/cc/write-interface.d.ts +5 -0
- package/lib/src/idl/cc/write-interface.js +228 -0
- package/lib/src/idl/cc/write-interface.js.map +1 -0
- package/lib/src/idl/cc/write-skeleton.d.ts +2 -0
- package/lib/src/idl/cc/write-skeleton.js +43 -0
- package/lib/src/idl/cc/write-skeleton.js.map +1 -0
- package/lib/src/idl/cc/write-stub.d.ts +2 -0
- package/lib/src/idl/cc/write-stub.js +91 -0
- package/lib/src/idl/cc/write-stub.js.map +1 -0
- package/lib/src/idl/idl-lexer.d.ts +19 -0
- package/lib/src/idl/idl-lexer.js +234 -0
- package/lib/src/idl/idl-lexer.js.map +1 -0
- package/lib/src/idl/idl-node.d.ts +102 -0
- package/lib/src/idl/idl-node.js +214 -0
- package/lib/src/idl/idl-node.js.map +1 -0
- package/lib/src/idl/idl-parser.d.ts +3 -0
- package/lib/src/idl/idl-parser.js +1210 -0
- package/lib/src/idl/idl-parser.js.map +1 -0
- package/lib/src/idl/idl.d.ts +1 -0
- package/lib/src/idl/idl.js +219 -0
- package/lib/src/idl/idl.js.map +1 -0
- package/lib/src/idl/ts/typeIDLtoGIOPTS.d.ts +3 -0
- package/lib/src/idl/ts/typeIDLtoGIOPTS.js +101 -0
- package/lib/src/idl/ts/typeIDLtoGIOPTS.js.map +1 -0
- package/lib/src/idl/ts/typeIDLtoTS.d.ts +3 -0
- package/lib/src/idl/ts/typeIDLtoTS.js +92 -0
- package/lib/src/idl/ts/typeIDLtoTS.js.map +1 -0
- package/lib/src/idl/ts/write-interface.d.ts +2 -0
- package/lib/src/idl/ts/write-interface.js +214 -0
- package/lib/src/idl/ts/write-interface.js.map +1 -0
- package/lib/src/idl/ts/write-skeleton.d.ts +2 -0
- package/lib/src/idl/ts/write-skeleton.js +118 -0
- package/lib/src/idl/ts/write-skeleton.js.map +1 -0
- package/lib/src/idl/ts/write-stub.d.ts +2 -0
- package/lib/src/idl/ts/write-stub.js +118 -0
- package/lib/src/idl/ts/write-stub.js.map +1 -0
- package/lib/src/idl/ts/write-value.d.ts +2 -0
- package/lib/src/idl/ts/write-value.js +208 -0
- package/lib/src/idl/ts/write-value.js.map +1 -0
- package/lib/src/idl/ts/write-valueimpl.d.ts +2 -0
- package/lib/src/idl/ts/write-valueimpl.js +159 -0
- package/lib/src/idl/ts/write-valueimpl.js.map +1 -0
- package/lib/src/idl/ts/write-valuetype.d.ts +2 -0
- package/lib/src/idl/ts/write-valuetype.js +99 -0
- package/lib/src/idl/ts/write-valuetype.js.map +1 -0
- package/lib/src/idl/util.d.ts +23 -0
- package/lib/src/idl/util.js +84 -0
- package/lib/src/idl/util.js.map +1 -0
- package/lib/src/index.d.ts +5 -0
- package/lib/src/index.js +6 -0
- package/lib/src/index.js.map +1 -0
- package/lib/src/net/browser.d.ts +7 -0
- package/lib/src/net/browser.js +55 -0
- package/lib/src/net/browser.js.map +1 -0
- package/lib/src/net/index.d.ts +3 -0
- package/lib/src/net/index.js +4 -0
- package/lib/src/net/index.js.map +1 -0
- package/lib/src/net/tcp.d.ts +11 -0
- package/lib/src/net/tcp.js +66 -0
- package/lib/src/net/tcp.js.map +1 -0
- package/lib/src/net/tls.d.ts +24 -0
- package/lib/src/net/tls.js +69 -0
- package/lib/src/net/tls.js.map +1 -0
- package/lib/src/net/ws.d.ts +44 -0
- package/lib/src/net/ws.js +158 -0
- package/lib/src/net/ws.js.map +1 -0
- package/lib/src/orb/asn1.d.ts +48 -0
- package/lib/src/orb/asn1.js +60 -0
- package/lib/src/orb/asn1.js.map +1 -0
- package/lib/src/orb/connection.d.ts +24 -0
- package/lib/src/orb/connection.js +19 -0
- package/lib/src/orb/connection.js.map +1 -0
- package/lib/src/orb/giop.d.ts +283 -0
- package/lib/src/orb/giop.js +1301 -0
- package/lib/src/orb/giop.js.map +1 -0
- package/lib/src/orb/index.d.ts +3 -0
- package/lib/src/orb/index.js +4 -0
- package/lib/src/orb/index.js.map +1 -0
- package/lib/src/orb/ior.d.ts +89 -0
- package/lib/src/orb/ior.js +113 -0
- package/lib/src/orb/ior.js.map +1 -0
- package/lib/src/orb/orb.d.ts +143 -0
- package/lib/src/orb/orb.js +693 -0
- package/lib/src/orb/orb.js.map +1 -0
- package/lib/src/orb/protocol.d.ts +6 -0
- package/lib/src/orb/protocol.js +2 -0
- package/lib/src/orb/protocol.js.map +1 -0
- package/lib/src/orb/uint8map.d.ts +14 -0
- package/lib/src/orb/uint8map.js +48 -0
- package/lib/src/orb/uint8map.js.map +1 -0
- package/lib/src/orb/url.d.ts +55 -0
- package/lib/src/orb/url.js +255 -0
- package/lib/src/orb/url.js.map +1 -0
- package/package.json +79 -71
- package/m13-es-transformer.cjs +0 -190
package/m13-es-transformer.cjs
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
const typescript = require("typescript")
|
|
2
|
-
const path = require("path")
|
|
3
|
-
const { existsSync } = require("fs")
|
|
4
|
-
const { normalize } = require("path")
|
|
5
|
-
// import * as typescript from 'typescript'
|
|
6
|
-
// import * as path from 'path'
|
|
7
|
-
// import { existsSync } from 'fs'
|
|
8
|
-
// import { normalize } from 'path'
|
|
9
|
-
|
|
10
|
-
// this transformer applies the baseUrl & paths rules from the tsconfig.json file
|
|
11
|
-
// and appends .js to imports/exports, so that the typescript compiler's output
|
|
12
|
-
// can be used directly in ES6 module workflows without additional bundlers
|
|
13
|
-
|
|
14
|
-
// how TypeScript's rootDirs, baseUrl & paths work is documented in the TypeScript
|
|
15
|
-
// source in src/compiler/moduleNameResolver.ts as follows:
|
|
16
|
-
// * if a baseUrl is given, then absolute paths will be prefixed with the baseUrl
|
|
17
|
-
// * "paths": { PATTERN: [SUBSTITUTION, ...], ... }
|
|
18
|
-
// * PATTERN and SUBSTITUTION can have 0-1 '*' (which means that we can just split at '*')
|
|
19
|
-
// * if multiple patterns match, match with the longest prefix is choosen
|
|
20
|
-
// * the * in PATTERN is to be replaced with the * in SUBSTITUTION
|
|
21
|
-
|
|
22
|
-
const transformer = (program) => (transformationContext) => (sourceFile) => {
|
|
23
|
-
|
|
24
|
-
function transformAST(node) {
|
|
25
|
-
|
|
26
|
-
if (isImportExportDeclaration(node)) {
|
|
27
|
-
|
|
28
|
-
const compilerOptions = program.getCompilerOptions()
|
|
29
|
-
|
|
30
|
-
if (compilerOptions.baseUrl &&
|
|
31
|
-
!node.moduleSpecifier.text.startsWith('.')
|
|
32
|
-
) {
|
|
33
|
-
let newModuleName = resolveBaseUrlAndPath(program, node)
|
|
34
|
-
if (newModuleName !== undefined) {
|
|
35
|
-
if (!newModuleName.endsWith(".js")) {
|
|
36
|
-
newModuleName += ".js"
|
|
37
|
-
}
|
|
38
|
-
const newModuleSpecifier = typescript.factory.createStringLiteral(newModuleName)
|
|
39
|
-
if (typescript.isImportDeclaration(node)) {
|
|
40
|
-
return typescript.factory.updateImportDeclaration(node, node.modifiers, node.importClause, newModuleSpecifier, node.assertClause)
|
|
41
|
-
} else if (typescript.isExportDeclaration(node)) {
|
|
42
|
-
return typescript.factory.updateExportDeclaration(node, node.modifiers, node.isTypeOnly, node.exportClause, newModuleSpecifier, node.assertClause)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (shouldMutateModuleSpecifier(node)) {
|
|
48
|
-
const newModuleSpecifier = typescript.factory.createStringLiteral(`${node.moduleSpecifier.text}.js`)
|
|
49
|
-
if (typescript.isImportDeclaration(node)) {
|
|
50
|
-
return typescript.factory.updateImportDeclaration(node, node.modifiers, node.importClause, newModuleSpecifier, node.assertClause)
|
|
51
|
-
} else if (typescript.isExportDeclaration(node)) {
|
|
52
|
-
return typescript.factory.updateExportDeclaration(node, node.modifiers, node.isTypeOnly, node.exportClause, newModuleSpecifier, node.assertClause)
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return typescript.visitEachChild(node, transformAST, transformationContext)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function isImportExportDeclaration(node) {
|
|
61
|
-
return (typescript.isImportDeclaration(node) || typescript.isExportDeclaration(node))
|
|
62
|
-
&& node.moduleSpecifier !== undefined
|
|
63
|
-
&& typescript.isStringLiteral(node.moduleSpecifier)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function shouldMutateModuleSpecifier(node) {
|
|
67
|
-
// only when path is relative
|
|
68
|
-
if (!node.moduleSpecifier.text.startsWith('./') &&
|
|
69
|
-
!node.moduleSpecifier.text.startsWith('../')) {
|
|
70
|
-
return false
|
|
71
|
-
}
|
|
72
|
-
// only when module specifier has no extension
|
|
73
|
-
if (path.extname(node.moduleSpecifier.text) !== '') {
|
|
74
|
-
return false
|
|
75
|
-
}
|
|
76
|
-
return true
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return typescript.visitNode(sourceFile, transformAST)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function resolveBaseUrlAndPath(program, node) {
|
|
83
|
-
let moduleName = node.moduleSpecifier.text
|
|
84
|
-
const compilerOptions = program.getCompilerOptions()
|
|
85
|
-
if (compilerOptions?.baseUrl == undefined) {
|
|
86
|
-
return undefined
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
let filename = (node?.parent?.fileName) ?? node?.original?.parent?.fileName
|
|
90
|
-
if (filename === undefined) {
|
|
91
|
-
return
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (filename.startsWith(compilerOptions.baseUrl)) {
|
|
95
|
-
|
|
96
|
-
for (let adjustedModuleName of tsPathResolver(compilerOptions, moduleName)) {
|
|
97
|
-
let found = false
|
|
98
|
-
for (let ext of ["ts", "tsx", "js", "jsx"]) {
|
|
99
|
-
const absoluteModuleName = normalize(`${compilerOptions.baseUrl}/${adjustedModuleName}.${ext}`)
|
|
100
|
-
if (existsSync(`${absoluteModuleName}`)) {
|
|
101
|
-
found = true
|
|
102
|
-
break
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (!found) {
|
|
106
|
-
continue
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const relativeModuleName = fromToFile(filename.substring(compilerOptions.baseUrl.length + 1), adjustedModuleName)
|
|
110
|
-
return relativeModuleName
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function tsPathResolver(config, moduleName) {
|
|
116
|
-
if (config.baseUrl === undefined || config.paths === undefined) {
|
|
117
|
-
return [moduleName]
|
|
118
|
-
}
|
|
119
|
-
if (moduleName.charAt(0) == ".") {
|
|
120
|
-
return [moduleName]
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// find the best pattern
|
|
124
|
-
let bestPattern
|
|
125
|
-
let bestPatternsHeadLength = 0
|
|
126
|
-
|
|
127
|
-
for (let pattern in config.paths) {
|
|
128
|
-
const asterisk = pattern.indexOf("*")
|
|
129
|
-
if (asterisk !== -1) {
|
|
130
|
-
const pathHead = pattern.substring(0, asterisk)
|
|
131
|
-
const pathTail = pattern.substring(asterisk + 1)
|
|
132
|
-
if (pathHead.length > bestPatternsHeadLength &&
|
|
133
|
-
moduleName.startsWith(pathHead) &&
|
|
134
|
-
moduleName.endsWith(pathTail)
|
|
135
|
-
) {
|
|
136
|
-
bestPatternsHeadLength = pathHead.length
|
|
137
|
-
bestPattern = pattern
|
|
138
|
-
}
|
|
139
|
-
} else {
|
|
140
|
-
if (pattern.length >= bestPatternsHeadLength &&
|
|
141
|
-
pattern === moduleName
|
|
142
|
-
) {
|
|
143
|
-
bestPatternsHeadLength = pattern.length
|
|
144
|
-
bestPattern = moduleName
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// apply the best pattern's substitutions
|
|
150
|
-
if (bestPattern !== undefined) {
|
|
151
|
-
const asterisk = bestPattern.indexOf("*")
|
|
152
|
-
if (asterisk !== -1) {
|
|
153
|
-
const pathTail = bestPattern.substring(asterisk + 1)
|
|
154
|
-
const middle = moduleName.substring(asterisk, moduleName.length - pathTail.length)
|
|
155
|
-
const substitutions = config.paths[bestPattern]
|
|
156
|
-
return substitutions.map(substitution => {
|
|
157
|
-
const subAsterisk = substitution.indexOf("*")
|
|
158
|
-
const subHead = substitution.substring(0, subAsterisk)
|
|
159
|
-
const subTail = substitution.substring(subAsterisk + 1)
|
|
160
|
-
return `${subHead}${middle}${subTail}`
|
|
161
|
-
})
|
|
162
|
-
} else {
|
|
163
|
-
return config.paths[bestPattern]
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return [moduleName]
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function fromToFile(fromFile, toFile) {
|
|
170
|
-
const fromFileParts = fromFile.split("/")
|
|
171
|
-
const toFileParts = toFile.split("/")
|
|
172
|
-
|
|
173
|
-
const maxDepth = Math.min(fromFileParts.length, toFileParts.length)
|
|
174
|
-
let equalUntilDepth = 0
|
|
175
|
-
while (equalUntilDepth < maxDepth && fromFileParts[equalUntilDepth] == toFileParts[equalUntilDepth]) {
|
|
176
|
-
++equalUntilDepth
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
let relativeModuleName = "../".repeat(fromFileParts.length - equalUntilDepth - 1) // -1 is the file itself
|
|
180
|
-
if (relativeModuleName.length == 0) {
|
|
181
|
-
relativeModuleName = "./"
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
for (; equalUntilDepth < toFileParts.length; ++equalUntilDepth) {
|
|
185
|
-
relativeModuleName += toFileParts[equalUntilDepth] + "/"
|
|
186
|
-
}
|
|
187
|
-
return relativeModuleName = relativeModuleName.substring(0, relativeModuleName.length - 1) // strip last "/"
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
module.exports = transformer
|