jspm 4.0.0 → 4.0.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/assets/jspm.png +0 -0
- package/dist/cli.js +48 -50
- package/package.json +4 -3
package/assets/jspm.png
ADDED
|
Binary file
|
package/dist/cli.js
CHANGED
|
@@ -29299,7 +29299,7 @@ function cssPlugin({ minify, baseUrl }) {
|
|
|
29299
29299
|
};
|
|
29300
29300
|
}
|
|
29301
29301
|
|
|
29302
|
-
// src/
|
|
29302
|
+
// src/publish.ts
|
|
29303
29303
|
import fs8 from "node:fs/promises";
|
|
29304
29304
|
import path6 from "node:path";
|
|
29305
29305
|
import { pathToFileURL as pathToFileURL5 } from "node:url";
|
|
@@ -29774,7 +29774,7 @@ defineLazyProperty(apps, "browser", () => "browser");
|
|
|
29774
29774
|
defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
|
|
29775
29775
|
var open_default = open;
|
|
29776
29776
|
|
|
29777
|
-
// src/
|
|
29777
|
+
// src/publish.ts
|
|
29778
29778
|
init_utils();
|
|
29779
29779
|
init_logger();
|
|
29780
29780
|
init_config();
|
|
@@ -29790,7 +29790,7 @@ function showShortcuts(directory) {
|
|
|
29790
29790
|
\u2192 ${c12.bold(c12.bgBlueBright(c12.whiteBright(" p ")))} ${c12.dim(
|
|
29791
29791
|
"Open self-contained preview URL in the browser"
|
|
29792
29792
|
)}
|
|
29793
|
-
\u2192 ${c12.bold(c12.bgBlueBright(c12.whiteBright(" r ")))} ${c12.dim("Force
|
|
29793
|
+
\u2192 ${c12.bold(c12.bgBlueBright(c12.whiteBright(" r ")))} ${c12.dim("Force republish")}
|
|
29794
29794
|
\u2192 ${c12.bold(c12.bgBlueBright(c12.whiteBright(" q ")))} ${c12.dim("Stop (or Ctrl+C)")}`);
|
|
29795
29795
|
console.log(`${c12.blue("Info:")} Watching for changes in ${c12.cyan(directory)}...`);
|
|
29796
29796
|
process.stdin.setRawMode?.(true);
|
|
@@ -29812,18 +29812,16 @@ async function readJsonFile(filePath, defaultValue = {}) {
|
|
|
29812
29812
|
return defaultValue;
|
|
29813
29813
|
}
|
|
29814
29814
|
async function eject(flags) {
|
|
29815
|
-
const log2 = withType("
|
|
29815
|
+
const log2 = withType("publish/eject");
|
|
29816
29816
|
const pkg = flags.eject;
|
|
29817
29817
|
if (!pkg.startsWith("app:")) {
|
|
29818
|
-
throw new JspmError(
|
|
29819
|
-
`Only the app: JSPM deployment registry is currently supported for ejection.`
|
|
29820
|
-
);
|
|
29818
|
+
throw new JspmError(`Only the app: JSPM registry is currently supported for ejection.`);
|
|
29821
29819
|
}
|
|
29822
29820
|
const config = await loadConfig();
|
|
29823
29821
|
log2(
|
|
29824
29822
|
`Loaded config with ${config.providers ? Object.keys(config.providers).length : 0} provider configurations`
|
|
29825
29823
|
);
|
|
29826
|
-
const provider2 = flags.provider || config.
|
|
29824
|
+
const provider2 = flags.provider || config.defaultPublishProvider || "jspm.io";
|
|
29827
29825
|
const generator = await getGenerator(flags);
|
|
29828
29826
|
let name = pkg.slice(4);
|
|
29829
29827
|
if (name[0] !== "@")
|
|
@@ -29836,14 +29834,14 @@ async function eject(flags) {
|
|
|
29836
29834
|
startSpinner(`Ejecting ${c12.bold(pkg)}...`);
|
|
29837
29835
|
await generator.eject({ name, version: version3, provider: provider2 }, ".");
|
|
29838
29836
|
stopSpinner();
|
|
29839
|
-
startSpinner(`Merging
|
|
29837
|
+
startSpinner(`Merging published import map for ${c12.bold(pkg)}...`);
|
|
29840
29838
|
const env2 = await getEnv(flags);
|
|
29841
29839
|
await writeOutput(generator, null, env2, flags, flags.quiet);
|
|
29842
29840
|
stopSpinner();
|
|
29843
29841
|
console.log(`${c12.green("Ok:")} Package ${c12.green(pkg)} ejected into ${c12.bold(flags.dir)}`);
|
|
29844
29842
|
}
|
|
29845
29843
|
async function publish(flags = {}) {
|
|
29846
|
-
const log2 = withType("
|
|
29844
|
+
const log2 = withType("publish/publish");
|
|
29847
29845
|
const { initProject: initProject2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
29848
29846
|
try {
|
|
29849
29847
|
const projectConfig = await initProject2({
|
|
@@ -29869,7 +29867,7 @@ async function publish(flags = {}) {
|
|
|
29869
29867
|
if (flags.watch) {
|
|
29870
29868
|
if (semverVersion || !version3.match(/^[a-zA-Z0-9_\-]+$/)) {
|
|
29871
29869
|
throw new JspmError(
|
|
29872
|
-
`Invalid version "${version3}" for
|
|
29870
|
+
`Invalid version "${version3}" for publish --watch. Watched publishes must be to mutable versions, which are alphanumeric only with - or _ separators.`
|
|
29873
29871
|
);
|
|
29874
29872
|
}
|
|
29875
29873
|
return startWatchMode(
|
|
@@ -29882,7 +29880,7 @@ async function publish(flags = {}) {
|
|
|
29882
29880
|
prepareScript
|
|
29883
29881
|
);
|
|
29884
29882
|
}
|
|
29885
|
-
return
|
|
29883
|
+
return publishOnce(
|
|
29886
29884
|
name,
|
|
29887
29885
|
version3,
|
|
29888
29886
|
projectConfig.projectPath,
|
|
@@ -29897,16 +29895,16 @@ async function publish(flags = {}) {
|
|
|
29897
29895
|
throw new JspmError(`Failed to initialize project: ${error2.message}`);
|
|
29898
29896
|
}
|
|
29899
29897
|
}
|
|
29900
|
-
async function
|
|
29901
|
-
const log2 = withType("
|
|
29898
|
+
async function publishOnce(name, version3, directory, flags, logSnippet, prepareScript) {
|
|
29899
|
+
const log2 = withType("publish");
|
|
29902
29900
|
const config = await loadConfig();
|
|
29903
29901
|
log2(
|
|
29904
29902
|
`Loaded config with ${config.providers ? Object.keys(config.providers).length : 0} provider configurations`
|
|
29905
29903
|
);
|
|
29906
|
-
const
|
|
29907
|
-
if (!
|
|
29904
|
+
const publishProvider = flags.provider || config.defaultPublishProvider;
|
|
29905
|
+
if (!publishProvider) {
|
|
29908
29906
|
throw new JspmError(
|
|
29909
|
-
`No
|
|
29907
|
+
`No publish provider specified. Please provide a provider with the --provider flag (e.g., jspm publish -p jspm.io) or set a default provider in your config.`
|
|
29910
29908
|
);
|
|
29911
29909
|
}
|
|
29912
29910
|
if (prepareScript) {
|
|
@@ -29914,22 +29912,22 @@ async function deployOnce(name, version3, directory, flags, logSnippet, prepareS
|
|
|
29914
29912
|
await runPackageScript(prepareScript, directory);
|
|
29915
29913
|
console.log(`${c12.blue("Info:")} ${c12.bold("prepare")} script completed`);
|
|
29916
29914
|
}
|
|
29917
|
-
startSpinner(`
|
|
29915
|
+
startSpinner(`Publishing ${c12.bold(`${name}@${version3}`)} to ${publishProvider}...`);
|
|
29918
29916
|
const generator = await getGenerator(flags, {
|
|
29919
29917
|
mapUrl: pathToFileURL5(`${directory}/`)
|
|
29920
29918
|
});
|
|
29921
29919
|
try {
|
|
29922
|
-
const { packageUrl, mapUrl, codeSnippet } = await generator.
|
|
29920
|
+
const { packageUrl, mapUrl, codeSnippet } = await generator.publish({
|
|
29923
29921
|
package: pathToFileURL5(directory).href,
|
|
29924
29922
|
name,
|
|
29925
29923
|
version: version3,
|
|
29926
|
-
provider:
|
|
29924
|
+
provider: publishProvider,
|
|
29927
29925
|
importMap: true,
|
|
29928
29926
|
install: true
|
|
29929
29927
|
});
|
|
29930
29928
|
stopSpinner();
|
|
29931
29929
|
console.log(
|
|
29932
|
-
`${c12.green("Ok:")} Package
|
|
29930
|
+
`${c12.green("Ok:")} Package published to ${c12.green(packageUrl)} with import map ${c12.green(
|
|
29933
29931
|
mapUrl
|
|
29934
29932
|
)}`
|
|
29935
29933
|
);
|
|
@@ -29946,14 +29944,14 @@ ${c12.greenBright(
|
|
|
29946
29944
|
return { packageUrl, mapUrl, codeSnippet };
|
|
29947
29945
|
} catch (error2) {
|
|
29948
29946
|
stopSpinner();
|
|
29949
|
-
throw new JspmError(`Failed to
|
|
29947
|
+
throw new JspmError(`Failed to publish: ${error2.message}`);
|
|
29950
29948
|
}
|
|
29951
29949
|
}
|
|
29952
29950
|
async function startWatchMode(name, version3, directory, ignore2, include, flags, prepareScript) {
|
|
29953
|
-
let
|
|
29951
|
+
let lastPublishTime = 0;
|
|
29954
29952
|
const fileMTimes = /* @__PURE__ */ new Map();
|
|
29955
29953
|
let packageUrl, codeSnippet;
|
|
29956
|
-
let
|
|
29954
|
+
let forcedRepublish = false;
|
|
29957
29955
|
let lastRunWasError = false;
|
|
29958
29956
|
let waiting = false;
|
|
29959
29957
|
await watchLoop(true);
|
|
@@ -29997,7 +29995,7 @@ ${c12.blue("Info:")} Watch mode stopped`);
|
|
|
29997
29995
|
open_default(packageUrl.endsWith("/") ? packageUrl : `${packageUrl}/`);
|
|
29998
29996
|
break;
|
|
29999
29997
|
case "r":
|
|
30000
|
-
|
|
29998
|
+
forcedRepublish = true;
|
|
30001
29999
|
break;
|
|
30002
30000
|
case "c":
|
|
30003
30001
|
if (codeSnippet)
|
|
@@ -30017,7 +30015,7 @@ ${codeSnippet.split("\n").filter((l) => !l.startsWith("<!--") || !l.endsWith("--
|
|
|
30017
30015
|
});
|
|
30018
30016
|
async function watchLoop(firstRun) {
|
|
30019
30017
|
try {
|
|
30020
|
-
if (Date.now() -
|
|
30018
|
+
if (Date.now() - lastPublishTime < 2e3) {
|
|
30021
30019
|
return;
|
|
30022
30020
|
}
|
|
30023
30021
|
const changes = [];
|
|
@@ -30044,7 +30042,7 @@ ${codeSnippet.split("\n").filter((l) => !l.startsWith("<!--") || !l.endsWith("--
|
|
|
30044
30042
|
fileMTimes.delete(filePath);
|
|
30045
30043
|
}
|
|
30046
30044
|
}
|
|
30047
|
-
if (changes.length ||
|
|
30045
|
+
if (changes.length || forcedRepublish) {
|
|
30048
30046
|
waiting = false;
|
|
30049
30047
|
if (!firstRun) {
|
|
30050
30048
|
if (lastRunWasError)
|
|
@@ -30052,11 +30050,11 @@ ${codeSnippet.split("\n").filter((l) => !l.startsWith("<!--") || !l.endsWith("--
|
|
|
30052
30050
|
else
|
|
30053
30051
|
hideShortcuts();
|
|
30054
30052
|
console.log(
|
|
30055
|
-
`${c12.blue("Info:")} ${
|
|
30053
|
+
`${c12.blue("Info:")} ${forcedRepublish ? "Requesting republish" : changes.length > 1 ? "Multiple changes detected" : `${path6.relative(directory, changes[0]).replace(/\\/g, "/")} changed`}, republishing...`
|
|
30056
30054
|
);
|
|
30057
30055
|
}
|
|
30058
|
-
|
|
30059
|
-
({ packageUrl, codeSnippet } = await
|
|
30056
|
+
forcedRepublish = false;
|
|
30057
|
+
({ packageUrl, codeSnippet } = await publishOnce(
|
|
30060
30058
|
name,
|
|
30061
30059
|
version3,
|
|
30062
30060
|
directory,
|
|
@@ -30064,7 +30062,7 @@ ${codeSnippet.split("\n").filter((l) => !l.startsWith("<!--") || !l.endsWith("--
|
|
|
30064
30062
|
(flags.usage ?? true) && firstRun,
|
|
30065
30063
|
prepareScript
|
|
30066
30064
|
));
|
|
30067
|
-
|
|
30065
|
+
lastPublishTime = Date.now();
|
|
30068
30066
|
showShortcuts(directory);
|
|
30069
30067
|
lastRunWasError = false;
|
|
30070
30068
|
waiting = true;
|
|
@@ -33062,13 +33060,13 @@ optionally using the JSPM overrides for these via the "jspm" property in the pac
|
|
|
33062
33060
|
).action(wrapCommand(build));
|
|
33063
33061
|
outputOpts(
|
|
33064
33062
|
generateOpts(
|
|
33065
|
-
cli.command("
|
|
33063
|
+
cli.command("publish", `Publish package to a provider (experimental)`).option(
|
|
33066
33064
|
"--no-usage",
|
|
33067
|
-
"Disable printing HTML/JS import code examples after successful
|
|
33065
|
+
"Disable printing HTML/JS import code examples after successful publish",
|
|
33068
33066
|
{
|
|
33069
33067
|
default: true
|
|
33070
33068
|
}
|
|
33071
|
-
).option("-w, --watch", "Watch for changes and
|
|
33069
|
+
).option("-w, --watch", "Watch for changes and republish (experimental)", {
|
|
33072
33070
|
default: false
|
|
33073
33071
|
}).option(
|
|
33074
33072
|
"-n, --name <name>",
|
|
@@ -33078,60 +33076,60 @@ outputOpts(
|
|
|
33078
33076
|
"-v, --version <version>",
|
|
33079
33077
|
"Publish with a custom version instead of the version from package.json",
|
|
33080
33078
|
{}
|
|
33081
|
-
).option("--eject <package>", "Eject a
|
|
33079
|
+
).option("--eject <package>", "Eject a published package instead of publishing", {}),
|
|
33082
33080
|
true
|
|
33083
33081
|
),
|
|
33084
33082
|
true
|
|
33085
33083
|
).example(
|
|
33086
33084
|
(name) => `
|
|
33087
|
-
$ ${name}
|
|
33085
|
+
$ ${name} publish
|
|
33088
33086
|
|
|
33089
|
-
|
|
33087
|
+
Publish the current directory as a package to the JSPM CDN.
|
|
33090
33088
|
`
|
|
33091
33089
|
).example(
|
|
33092
33090
|
(name) => `
|
|
33093
|
-
$ ${name}
|
|
33091
|
+
$ ${name} publish -p jspm.io
|
|
33094
33092
|
|
|
33095
|
-
|
|
33093
|
+
Publish the current package as a package to the JSPM CDN.
|
|
33096
33094
|
`
|
|
33097
33095
|
).example(
|
|
33098
33096
|
(name) => `
|
|
33099
|
-
$ ${name}
|
|
33097
|
+
$ ${name} publish --dir dist --version dev-feat-2 --watch
|
|
33100
33098
|
|
|
33101
|
-
Start a watched
|
|
33099
|
+
Start a watched publish to a custom mutable version tag (dev-feat-2) instead of the version from package.json.
|
|
33102
33100
|
`
|
|
33103
33101
|
).example(
|
|
33104
33102
|
(name) => `
|
|
33105
|
-
$ ${name}
|
|
33103
|
+
$ ${name} publish --eject app:foo@bar --dir foo
|
|
33106
33104
|
|
|
33107
33105
|
Download the application package foo@bar into the folder foo, merging its import map into foo/importmap.js.
|
|
33108
33106
|
`
|
|
33109
33107
|
).example(
|
|
33110
33108
|
(name) => `
|
|
33111
|
-
$ ${name}
|
|
33109
|
+
$ ${name} publish --eject app:foo@bar --dir foo -o test.html
|
|
33112
33110
|
|
|
33113
33111
|
Download the application package foo@bar into the folder foo, merging its import map into the provided HTML file.
|
|
33114
33112
|
`
|
|
33115
33113
|
).usage(
|
|
33116
|
-
`
|
|
33114
|
+
`publish [options]
|
|
33117
33115
|
|
|
33118
|
-
Manages
|
|
33116
|
+
Manages publishes to the JSPM providers, currently in experimental preview.
|
|
33119
33117
|
|
|
33120
33118
|
For publishing (default):
|
|
33121
33119
|
|
|
33122
|
-
jspm
|
|
33120
|
+
jspm publish
|
|
33123
33121
|
|
|
33124
33122
|
- The provider flag is always required, with limited signups only available on the jspm.io provider currently
|
|
33125
33123
|
- The package must have a valid package.json with name and version fields.
|
|
33126
33124
|
- The package.json "files" and "ignore" arrays will be respected.
|
|
33127
|
-
- Semver versions are always immutable
|
|
33128
|
-
- Mutable versions supporting
|
|
33125
|
+
- Semver versions are always immutable publishes that cannot be republished.
|
|
33126
|
+
- Mutable versions supporting republishing must only contain alphanumeric characters, hyphens, and underscores [a-zA-Z0-9_-].
|
|
33129
33127
|
|
|
33130
33128
|
For ejecting a published package:
|
|
33131
33129
|
|
|
33132
|
-
jspm
|
|
33130
|
+
jspm download --eject <packagename@packageversion> --dir <directory>
|
|
33133
33131
|
|
|
33134
|
-
- Ejects a
|
|
33132
|
+
- Ejects a published package into a local directory, stitching its published import map into the target import map.
|
|
33135
33133
|
- The --dir flag is required to specify the output project directory when using --eject.
|
|
33136
33134
|
`
|
|
33137
33135
|
).action(
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jspm",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.2",
|
|
5
5
|
"description": "Import Map Package Manager",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"bin": {
|
|
8
8
|
"jspm": "./dist/jspm.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
|
+
"assets",
|
|
11
12
|
"dist"
|
|
12
13
|
],
|
|
13
14
|
"scripts": {
|
|
@@ -16,8 +17,8 @@
|
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
19
|
"@babel/core": "^7.24.7",
|
|
19
|
-
"@jspm/generator": "^2.6.
|
|
20
|
-
"@jspm/plugin-rollup": "^1.2.
|
|
20
|
+
"@jspm/generator": "^2.6.1",
|
|
21
|
+
"@jspm/plugin-rollup": "^1.2.4",
|
|
21
22
|
"ora": "^8.2.0",
|
|
22
23
|
"picocolors": "^1.1.1"
|
|
23
24
|
},
|