@trackunit/iris-app-webpack-plugin 0.0.49-alpha-5bc30eb95.0 → 0.0.49
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/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
-
### [0.0.49
|
|
5
|
+
### [0.0.49](https://github.com/Trackunit/manager/compare/iris-app-webpack-plugin/0.0.48...iris-app-webpack-plugin/0.0.49) (2022-09-02)
|
|
6
6
|
|
|
7
7
|
### [0.0.48](https://github.com/Trackunit/manager/compare/iris-app-webpack-plugin/0.0.47...iris-app-webpack-plugin/0.0.48) (2022-08-30)
|
|
8
8
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/iris-app-webpack-plugin",
|
|
3
|
-
"version": "0.0.49
|
|
3
|
+
"version": "0.0.49",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": "https://github.com/Trackunit/manager",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"typings": "./src/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@trackunit/iris-app-api": "0.0.
|
|
9
|
+
"@trackunit/iris-app-api": "0.0.45",
|
|
10
10
|
"tslib": "^2.3.1"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {}
|
|
@@ -46,12 +46,7 @@ class TrackunitIrisAppWebpackPlugin {
|
|
|
46
46
|
const packageJson = fs.readFileSync(`${this.options.appDir}/package.json`, "utf8");
|
|
47
47
|
compilation.emitAsset("package.json", new RawSource(packageJson));
|
|
48
48
|
let html = indexContents.replace("{{validDomains}}", manifest.validDomains.join(" "));
|
|
49
|
-
html = html.replace("{{
|
|
50
|
-
return {
|
|
51
|
-
href: `?app=${manifestJson.moduleFederationName}&extension=${extension.id}`,
|
|
52
|
-
text: extension.id,
|
|
53
|
-
};
|
|
54
|
-
})));
|
|
49
|
+
html = html.replace("{{scope}}", JSON.parse(packageJson).name);
|
|
55
50
|
// Adding new asset to the compilation, so it would be automatically
|
|
56
51
|
// generated by the webpack in the output directory.
|
|
57
52
|
compilation.emitAsset("index.html", new RawSource(html));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TrackunitIrisAppWebpackPlugin.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-webpack-plugin/src/lib/TrackunitIrisAppWebpackPlugin.ts"],"names":[],"mappings":";;;;AACA,+CAAyB;AACzB,mDAA6B;AAS7B,MAAa,6BAA6B;IACxC,YAA2B,OAA8C;QAA9C,YAAO,GAAP,OAAO,CAAuC;IAAG,CAAC;IAEtE,KAAK,CAAC,QAAqB;QAChC,MAAM,UAAU,GAAG,6BAA6B,CAAC,IAAI,CAAC;QAEtD,oEAAoE;QACpE,0DAA0D;QAC1D,uEAAuE;QACvE,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;QAE7B,kEAAkE;QAClE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;QAEhC,gEAAgE;QAChE,6CAA6C;QAC7C,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;QAEtC,gEAAgE;QAChE,kDAAkD;QAClD,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,WAA2B,EAAE,EAAE;YAC7E,iEAAiE;YACjE,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CACjC;gBACE,IAAI,EAAE,UAAU;gBAEhB,2DAA2D;gBAC3D,0EAA0E;gBAC1E,KAAK,EAAE,WAAW,CAAC,4BAA4B;aAChD,EACD,CAAM,MAAM,EAAC,EAAE;gBACb,iDAAiD;gBACjD,yEAAyE;gBACzE,mCAAmC;;gBAEnC,oCAAoC;gBACpC,4CAA4C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,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;gBAE7F,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,eAAe,EAAE,MAAM,CAAC,CAAC;gBACnF,WAAW,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;gBAElE,IAAI,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,kBAAkB,EAAE,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;gBACtF,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;gBAC/D,oEAAoE;gBACpE,oDAAoD;gBACpD,WAAW,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;YAC3D,CAAC,CAAA,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA3DD,sEA2DC","sourcesContent":["import { IrisAppManifest } from \"@trackunit/iris-app-api\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport * as wp from \"webpack\";\n\ninterface ITrackunitIrisAppWebpackPluginOptions {\n nxRootDir: string;\n appDir: string;\n manifest: IrisAppManifest;\n}\n\nexport class TrackunitIrisAppWebpackPlugin {\n public constructor(private options: ITrackunitIrisAppWebpackPluginOptions) {}\n\n public apply(compiler: wp.Compiler) {\n const pluginName = TrackunitIrisAppWebpackPlugin.name;\n\n // webpack module instance can be accessed from the compiler object,\n // this ensures that correct version of the module is used\n // (do not require/import the webpack or any symbols from it directly).\n const { webpack } = compiler;\n\n // Compilation object gives us reference to some useful constants.\n const { Compilation } = webpack;\n\n // RawSource is one of the \"sources\" classes that should be used\n // to represent asset sources in compilation.\n const { RawSource } = webpack.sources;\n\n // Tapping to the \"thisCompilation\" hook in order to further tap\n // to the compilation process on an earlier stage.\n compiler.hooks.thisCompilation.tap(pluginName, (compilation: wp.Compilation) => {\n // Tapping to the assets processing pipeline on a specific stage.\n compilation.hooks.processAssets.tap(\n {\n name: pluginName,\n\n // Using one of the later asset processing stages to ensure\n // that all assets were already added to the compilation by other plugins.\n stage: Compilation.PROCESS_ASSETS_STAGE_DERIVED,\n },\n async assets => {\n // \"assets\" is an object that contains all assets\n // in the compilation, the keys of the object are pathnames of the assets\n // and the values are file sources.\n\n // Iterating over all the assets and\n // generating content for our Markdown file.\n if (!this.options?.manifest) {\n throw Error(\"you must provide a app manifest\");\n }\n const manifest = this.options.manifest;\n const indexContents = fs.readFileSync(path.join(__dirname, \"index.html\"), \"utf8\");\n\n const manifestJson = this.options.manifest;\n manifestJson.extensions = this.options.manifest.extensions;\n compilation.emitAsset(\"manifest.json\", new RawSource(JSON.stringify(manifestJson, null, 2)));\n\n const packageJson = fs.readFileSync(`${this.options.appDir}/package.json`, \"utf8\");\n compilation.emitAsset(\"package.json\", new RawSource(packageJson));\n\n let html = indexContents.replace(\"{{validDomains}}\", manifest.validDomains.join(\" \"));\n html = html.replace(\"{{scope}}\", JSON.parse(packageJson).name);\n // Adding new asset to the compilation, so it would be automatically\n // generated by the webpack in the output directory.\n compilation.emitAsset(\"index.html\", new RawSource(html));\n }\n );\n });\n }\n}\n"]}
|
package/src/lib/index.html
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
<html>
|
|
2
2
|
<head>
|
|
3
|
+
<script>
|
|
4
|
+
module = location.pathname.split('/')[1];
|
|
5
|
+
scope = "{{scope}}";
|
|
6
|
+
</script>
|
|
7
|
+
<base href="/"></base>
|
|
3
8
|
<script src="/remoteEntry.js"></script>
|
|
4
9
|
<script src="https://apps.dev.iris.trackunit.com/tileloader.js"></script>
|
|
5
10
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' {{validDomains}};">
|
|
6
11
|
</head>
|
|
7
12
|
<body style="margin: 0px">
|
|
8
13
|
</body>
|
|
9
|
-
<script>
|
|
10
|
-
if(location.href.indexOf("/render") === -1) {
|
|
11
|
-
const elem = document.createElement('span');
|
|
12
|
-
elem.innerHTML = '<b>Launch the manager in local mode for testing: <a href="https://dev.manager.trackunit.com/tiles-portal/main#runLocal">https://dev.manager.trackunit.com/tiles-portal/main#runLocal</a> </b>'
|
|
13
|
-
document.body.appendChild(elem);
|
|
14
|
-
document.body.style = "padding: 20px;"
|
|
15
|
-
}
|
|
16
|
-
</script>
|
|
17
14
|
</html>
|