@jsenv/plugin-as-js-classic 1.1.0 → 1.1.2

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 CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@jsenv/plugin-as-js-classic",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/jsenv/core",
8
- "directory": "packages/jsenv-plugin-as-js-classic"
8
+ "directory": "packages/related/plugin-as-js-classic"
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public"
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@jsenv/urls": "2.0.0",
28
- "@jsenv/js-module-fallback": "1.0.0",
29
- "@jsenv/plugin-bundling": "2.1.10"
28
+ "@jsenv/js-module-fallback": "1.0.3",
29
+ "@jsenv/plugin-bundling": "2.1.11"
30
30
  }
31
31
  }
@@ -80,12 +80,29 @@ export const jsenvPluginAsJsClassic = ({
80
80
  }
81
81
  });
82
82
  }
83
+
84
+ let outputFormat;
85
+ if (urlInfo.isEntryPoint && !jsModuleUrlInfo.data.usesImport) {
86
+ // if it's an entry point without dependency (it does not use import)
87
+ // then we can use UMD
88
+ outputFormat = "umd";
89
+ } else {
90
+ // otherwise we have to use system in case it's imported
91
+ // by an other file (for entry points)
92
+ // or to be able to import when it uses import
93
+ outputFormat = "system";
94
+ }
95
+ urlInfo.data.jsClassicFormat = outputFormat;
83
96
  const { content, sourcemap } = await convertJsModuleToJsClassic({
84
97
  rootDirectoryUrl: context.rootDirectoryUrl,
85
98
  systemJsInjection,
86
99
  systemJsClientFileUrl,
87
- urlInfo,
88
- jsModuleUrlInfo: jsModuleBundledUrlInfo,
100
+ input: jsModuleBundledUrlInfo.content,
101
+ inputIsEntryPoint: urlInfo.isEntryPoint,
102
+ inputSourcemap: jsModuleBundledUrlInfo.sourcemap,
103
+ inputUrl: jsModuleBundledUrlInfo.url,
104
+ outputUrl: jsModuleBundledUrlInfo.generatedUrl,
105
+ outputFormat,
89
106
  });
90
107
  return {
91
108
  content,