KT-3008 Implement AMD, CommonJS and UMD wrappers. Compile stdlib and builtins modules into separate JS files and wrap them in UMD.
This commit is contained in:
@@ -66,9 +66,10 @@ message Library {
|
||||
}
|
||||
|
||||
enum Kind {
|
||||
PLAIN = 1;
|
||||
AMD = 2;
|
||||
COMMON_JS = 3;
|
||||
PLAIN = 1;
|
||||
AMD = 2;
|
||||
COMMON_JS = 3;
|
||||
UMD = 4;
|
||||
}
|
||||
|
||||
repeated FileEntry entry = 1;
|
||||
|
||||
@@ -650,6 +650,10 @@ public final class JsProtoBuf {
|
||||
* <code>COMMON_JS = 3;</code>
|
||||
*/
|
||||
COMMON_JS(2, 3),
|
||||
/**
|
||||
* <code>UMD = 4;</code>
|
||||
*/
|
||||
UMD(3, 4),
|
||||
;
|
||||
|
||||
/**
|
||||
@@ -664,6 +668,10 @@ public final class JsProtoBuf {
|
||||
* <code>COMMON_JS = 3;</code>
|
||||
*/
|
||||
public static final int COMMON_JS_VALUE = 3;
|
||||
/**
|
||||
* <code>UMD = 4;</code>
|
||||
*/
|
||||
public static final int UMD_VALUE = 4;
|
||||
|
||||
|
||||
public final int getNumber() { return value; }
|
||||
@@ -673,6 +681,7 @@ public final class JsProtoBuf {
|
||||
case 1: return PLAIN;
|
||||
case 2: return AMD;
|
||||
case 3: return COMMON_JS;
|
||||
case 4: return UMD;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -94,6 +94,7 @@ object KotlinJavascriptSerializationUtil {
|
||||
ModuleKind.PLAIN -> JsProtoBuf.Library.Kind.PLAIN
|
||||
ModuleKind.AMD -> JsProtoBuf.Library.Kind.AMD
|
||||
ModuleKind.COMMON_JS -> JsProtoBuf.Library.Kind.COMMON_JS
|
||||
ModuleKind.UMD -> JsProtoBuf.Library.Kind.UMD
|
||||
}
|
||||
|
||||
importedModules.forEach { contentBuilder.addImportedModules(it) }
|
||||
@@ -249,6 +250,7 @@ private fun ByteArray.toContentMap(): JsModuleProto {
|
||||
null, JsProtoBuf.Library.Kind.PLAIN -> ModuleKind.PLAIN
|
||||
JsProtoBuf.Library.Kind.AMD -> ModuleKind.AMD
|
||||
JsProtoBuf.Library.Kind.COMMON_JS -> ModuleKind.COMMON_JS
|
||||
JsProtoBuf.Library.Kind.UMD -> ModuleKind.UMD
|
||||
},
|
||||
imported = content.importedModulesList
|
||||
)
|
||||
|
||||
@@ -21,5 +21,6 @@ package org.jetbrains.kotlin.serialization.js;
|
||||
public enum ModuleKind {
|
||||
PLAIN,
|
||||
AMD,
|
||||
COMMON_JS
|
||||
COMMON_JS,
|
||||
UMD
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user