@jsenv/core 27.0.0-alpha.7 → 27.0.0-alpha.8

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/core",
3
- "version": "27.0.0-alpha.7",
3
+ "version": "27.0.0-alpha.8",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -131,15 +131,6 @@ const rollupPluginJsenv = ({
131
131
  const rollupFileInfo = rollupResult[fileName]
132
132
  // there is 3 types of file: "placeholder", "asset", "chunk"
133
133
  if (rollupFileInfo.type === "chunk") {
134
- const { facadeModuleId } = rollupFileInfo
135
- let url
136
- if (facadeModuleId) {
137
- url = fileUrlConverter.asFileUrl(facadeModuleId)
138
- } else {
139
- const { sources } = rollupFileInfo.map
140
- const sourcePath = sources[sources.length - 1]
141
- url = fileUrlConverter.asFileUrl(sourcePath)
142
- }
143
134
  const jsModuleBundleUrlInfo = {
144
135
  // buildRelativeUrl: rollupFileInfo.fileName,
145
136
  data: {
@@ -149,6 +140,12 @@ const rollupPluginJsenv = ({
149
140
  content: rollupFileInfo.code,
150
141
  sourcemap: rollupFileInfo.map,
151
142
  }
143
+ let url
144
+ if (rollupFileInfo.facadeModuleId) {
145
+ url = fileUrlConverter.asFileUrl(rollupFileInfo.facadeModuleId)
146
+ } else {
147
+ url = new URL(rollupFileInfo.fileName, rootDirectoryUrl).href
148
+ }
152
149
  jsModuleBundleUrlInfos[url] = jsModuleBundleUrlInfo
153
150
  }
154
151
  })
@@ -171,13 +168,18 @@ const rollupPluginJsenv = ({
171
168
  },
172
169
  chunkFileNames: (chunkInfo) => {
173
170
  // preserves relative path parts:
174
- // the goal is to mantain the original relative path (relative to the root directory)
171
+ // the goal is to maintain the original relative path (relative to the root directory)
175
172
  // so that later in the build process, when resolving these urls, we are able to
176
173
  // re-resolve the specifier againt the original parent url and find the original url
177
- const { facadeModuleId } = chunkInfo
178
- const fileUrl = fileUrlConverter.asFileUrl(facadeModuleId)
179
- const relativePath = urlToRelativeUrl(fileUrl, rootDirectoryUrl)
180
- return relativePath
174
+ if (chunkInfo.facadeModuleId) {
175
+ const fileUrl = fileUrlConverter.asFileUrl(chunkInfo.facadeModuleId)
176
+ const relativePath = urlToRelativeUrl(fileUrl, rootDirectoryUrl)
177
+ return relativePath
178
+ }
179
+ // chunk generated dynamically by rollup to share code.
180
+ // we prefix with "__rollup__/" to avoid potential conflict of filename
181
+ // between this one and a file with the same name existing in the root directory
182
+ return `__rollup__/${chunkInfo.name}.js`
181
183
  },
182
184
  // https://rollupjs.org/guide/en/#outputpaths
183
185
  // paths: (id) => {