@temir.ra/create-template 0.4.1 → 0.4.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/CHANGELOG.md +4 -0
- package/buildinfo.txt +1 -1
- package/package.json +2 -2
- package/scripts/build-bundle.ts +8 -8
- package/scripts/import-map.json +1 -0
- package/template/package.json +1 -1
- package/template/scripts/build-bundle.ts +8 -8
- package/template/scripts/import-map.json +1 -0
- package/scripts/cdn-rewrite-map.json +0 -1
- package/template/scripts/cdn-rewrite-map.json +0 -1
package/CHANGELOG.md
CHANGED
package/buildinfo.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.4.
|
|
1
|
+
0.4.2+3253038
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temir.ra/create-template",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "A template for a template package.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"keywords": [
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"scripts/buildinfo.ts",
|
|
19
19
|
"scripts/build-bundle.ts",
|
|
20
|
-
"scripts/
|
|
20
|
+
"scripts/import-map.json",
|
|
21
21
|
"CHANGELOG.md",
|
|
22
22
|
"buildinfo.txt",
|
|
23
23
|
"dist/",
|
package/scripts/build-bundle.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
type BuildResult
|
|
12
12
|
} from 'esbuild';
|
|
13
13
|
|
|
14
|
-
import
|
|
14
|
+
import IMPORT_MAP from './import-map.json';
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
interface ExportConditions {
|
|
@@ -122,20 +122,20 @@ const esbuildLog: EsbuildPlugin = {
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
const
|
|
126
|
-
name: '
|
|
125
|
+
const importMap: EsbuildPlugin = {
|
|
126
|
+
name: 'import-map',
|
|
127
127
|
setup(build: PluginBuild) {
|
|
128
128
|
|
|
129
|
-
for (const [importSpecifier, urlTemplate] of Object.entries(
|
|
129
|
+
for (const [importSpecifier, urlTemplate] of Object.entries(IMPORT_MAP) as [string, string | null][]) {
|
|
130
130
|
|
|
131
|
-
const url = resolveVersionInCdnUrl(importSpecifier, urlTemplate);
|
|
132
|
-
console.log(`[
|
|
131
|
+
const url = urlTemplate ? resolveVersionInCdnUrl(importSpecifier, urlTemplate) : null;
|
|
132
|
+
console.log(`[import-map plugin] '${importSpecifier}' → ${url ? `'${url}'` : 'external (no rewrite)'}`);
|
|
133
133
|
|
|
134
134
|
const escapedSpecifier = importSpecifier.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
135
135
|
build.onResolve(
|
|
136
136
|
{ filter: new RegExp(`^${escapedSpecifier}$`) },
|
|
137
137
|
(args: OnResolveArgs): OnResolveResult | undefined => {
|
|
138
|
-
return { path: url, external: true };
|
|
138
|
+
return { path: url ?? args.path, external: true };
|
|
139
139
|
}
|
|
140
140
|
);
|
|
141
141
|
|
|
@@ -157,7 +157,7 @@ const buildOptions: BuildOptions = {
|
|
|
157
157
|
bundle: true,
|
|
158
158
|
minify: true,
|
|
159
159
|
sourcemap: 'external',
|
|
160
|
-
plugins: [esbuildLog,
|
|
160
|
+
plugins: [esbuildLog, importMap],
|
|
161
161
|
|
|
162
162
|
};
|
|
163
163
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/template/package.json
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
type BuildResult
|
|
12
12
|
} from 'esbuild';
|
|
13
13
|
|
|
14
|
-
import
|
|
14
|
+
import IMPORT_MAP from './import-map.json';
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
interface ExportConditions {
|
|
@@ -122,20 +122,20 @@ const esbuildLog: EsbuildPlugin = {
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
const
|
|
126
|
-
name: '
|
|
125
|
+
const importMap: EsbuildPlugin = {
|
|
126
|
+
name: 'import-map',
|
|
127
127
|
setup(build: PluginBuild) {
|
|
128
128
|
|
|
129
|
-
for (const [importSpecifier, urlTemplate] of Object.entries(
|
|
129
|
+
for (const [importSpecifier, urlTemplate] of Object.entries(IMPORT_MAP) as [string, string | null][]) {
|
|
130
130
|
|
|
131
|
-
const url = resolveVersionInCdnUrl(importSpecifier, urlTemplate);
|
|
132
|
-
console.log(`[
|
|
131
|
+
const url = urlTemplate ? resolveVersionInCdnUrl(importSpecifier, urlTemplate) : null;
|
|
132
|
+
console.log(`[import-map plugin] '${importSpecifier}' → ${url ? `'${url}'` : 'external (no rewrite)'}`);
|
|
133
133
|
|
|
134
134
|
const escapedSpecifier = importSpecifier.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
135
135
|
build.onResolve(
|
|
136
136
|
{ filter: new RegExp(`^${escapedSpecifier}$`) },
|
|
137
137
|
(args: OnResolveArgs): OnResolveResult | undefined => {
|
|
138
|
-
return { path: url, external: true };
|
|
138
|
+
return { path: url ?? args.path, external: true };
|
|
139
139
|
}
|
|
140
140
|
);
|
|
141
141
|
|
|
@@ -157,7 +157,7 @@ const buildOptions: BuildOptions = {
|
|
|
157
157
|
bundle: true,
|
|
158
158
|
minify: true,
|
|
159
159
|
sourcemap: 'external',
|
|
160
|
-
plugins: [esbuildLog,
|
|
160
|
+
plugins: [esbuildLog, importMap],
|
|
161
161
|
|
|
162
162
|
};
|
|
163
163
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|