@stlite/desktop 0.16.0 → 0.16.1

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.
@@ -92,6 +92,8 @@ async function copyStreamlitAppDirectory(options) {
92
92
  console.log(`Copy ${options.sourceDir} to ${options.copyTo}`);
93
93
  return fs_extra_1.default.copy(options.sourceDir, options.copyTo);
94
94
  }
95
+ // Original: packages/sharing-editor/bin/gen-sample-app-manifests-json.ts
96
+ // TODO: Be DRY
95
97
  async function readRequirements(requirementsTxtPath) {
96
98
  try {
97
99
  const requirementsTxtData = await promises_1.default.readFile(requirementsTxtPath, {
@@ -107,6 +109,24 @@ async function readRequirements(requirementsTxtPath) {
107
109
  return [];
108
110
  }
109
111
  }
112
+ // Original: kernel/src/requirements.ts
113
+ // TODO: Be DRY
114
+ function verifyRequirements(requirements) {
115
+ requirements.forEach((req) => {
116
+ let url;
117
+ try {
118
+ url = new URL(req);
119
+ }
120
+ catch {
121
+ // `req` is not a URL -> OK
122
+ return;
123
+ }
124
+ // Ref: The scheme checker in the micropip implementation is https://github.com/pyodide/micropip/blob/v0.1.0/micropip/_compat_in_pyodide.py#L23-L26
125
+ if (url.protocol === "emfs:" || url.protocol === "file:") {
126
+ throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${req})`);
127
+ }
128
+ });
129
+ }
110
130
  (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
111
131
  .command("* <appHomeDirSource> [packages..]", "Put the user code and data and the snapshot of the required packages into the build artifact.", () => { }, (argv) => {
112
132
  console.info(argv);
@@ -153,6 +173,7 @@ async function readRequirements(requirementsTxtPath) {
153
173
  for (const requirementTxtFilePath of args.requirement) {
154
174
  requirements = requirements.concat(await readRequirements(requirementTxtFilePath));
155
175
  }
176
+ verifyRequirements(requirements);
156
177
  await copyBuildDirectory({ copyTo: destDir, override: args.force });
157
178
  await createSitePackagesSnapshot({
158
179
  useLocalKernelWheels: args.localKernelWheels,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stlite/desktop",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "./",
6
6
  "main": "./build/electron/main.js",