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

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/plugin-as-js-classic",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@jsenv/urls": "2.0.0",
28
- "@jsenv/js-module-fallback": "1.0.3",
29
- "@jsenv/plugin-bundling": "2.1.11"
28
+ "@jsenv/js-module-fallback": "1.1.0",
29
+ "@jsenv/plugin-bundling": "2.2.0"
30
30
  }
31
31
  }
@@ -1,18 +1,14 @@
1
1
  import { urlToFilename } from "@jsenv/urls";
2
- import { convertJsModuleToJsClassic } from "@jsenv/js-module-fallback";
2
+ import {
3
+ convertJsModuleToJsClassic,
4
+ systemJsClientFileUrlDefault,
5
+ } from "@jsenv/js-module-fallback";
3
6
  import { bundleJsModules } from "@jsenv/plugin-bundling";
4
7
 
5
8
  import { createUrlGraphLoader } from "./url_graph_loader.js";
6
9
 
7
- export const jsenvPluginAsJsClassic = ({
8
- systemJsInjection = true,
9
- systemJsClientFileUrl,
10
- } = {}) => {
10
+ export const jsenvPluginAsJsClassic = () => {
11
11
  const markAsJsClassicProxy = (reference) => {
12
- if (reference.searchParams.has("dynamic_import")) {
13
- } else {
14
- reference.isEntryPoint = true;
15
- }
16
12
  reference.expectedType = "js_classic";
17
13
  reference.filename = generateJsClassicFilename(reference.url);
18
14
  };
@@ -75,14 +71,14 @@ export const jsenvPluginAsJsClassic = ({
75
71
  } else if (context.build) {
76
72
  jsModuleBundledUrlInfo.sourceUrls.forEach((sourceUrl) => {
77
73
  const sourceUrlInfo = context.urlGraph.getUrlInfo(sourceUrl);
78
- if (sourceUrlInfo && sourceUrlInfo.dependents.size === 0) {
74
+ if (sourceUrlInfo && !context.urlGraph.hasDependent(sourceUrlInfo)) {
79
75
  context.urlGraph.deleteUrlInfo(sourceUrl);
80
76
  }
81
77
  });
82
78
  }
83
79
 
84
80
  let outputFormat;
85
- if (urlInfo.isEntryPoint && !jsModuleUrlInfo.data.usesImport) {
81
+ if (urlInfo.isEntryPoint && !jsModuleBundledUrlInfo.data.usesImport) {
86
82
  // if it's an entry point without dependency (it does not use import)
87
83
  // then we can use UMD
88
84
  outputFormat = "umd";
@@ -91,14 +87,17 @@ export const jsenvPluginAsJsClassic = ({
91
87
  // by an other file (for entry points)
92
88
  // or to be able to import when it uses import
93
89
  outputFormat = "system";
90
+ urlInfo.type = "js_classic";
91
+ context.referenceUtils.foundSideEffectFile({
92
+ sideEffectFileUrl: systemJsClientFileUrlDefault,
93
+ expectedType: "js_classic",
94
+ line: 0,
95
+ column: 0,
96
+ });
94
97
  }
95
- urlInfo.data.jsClassicFormat = outputFormat;
96
98
  const { content, sourcemap } = await convertJsModuleToJsClassic({
97
99
  rootDirectoryUrl: context.rootDirectoryUrl,
98
- systemJsInjection,
99
- systemJsClientFileUrl,
100
100
  input: jsModuleBundledUrlInfo.content,
101
- inputIsEntryPoint: urlInfo.isEntryPoint,
102
101
  inputSourcemap: jsModuleBundledUrlInfo.sourcemap,
103
102
  inputUrl: jsModuleBundledUrlInfo.url,
104
103
  outputUrl: jsModuleBundledUrlInfo.generatedUrl,