@spyglassmc/java-edition 0.3.0 → 0.3.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.
@@ -18,13 +18,11 @@ interface GetMcmetaSummaryResult extends Partial<McmetaSummary> {
18
18
  */
19
19
  export declare function getMcmetaSummary(externals: core.Externals, downloader: core.Downloader, logger: core.Logger, version: string, isLatest: boolean, source: string, overridePaths?: core.EnvConfig['mcmetaSummaryOverrides']): Promise<GetMcmetaSummaryResult>;
20
20
  /**
21
- * @param version An already resolved version identifier.
22
- *
23
21
  * @throws Network/file system errors.
24
22
  *
25
23
  * @returns
26
24
  * - `startDepth`: The amount of level to skip when unzipping the tarball.
27
25
  * - `uri`: URI to the `.tar.gz` file.
28
26
  */
29
- export declare function getVanillaMcdoc(externals: core.Externals, downloader: core.Downloader, version: string, isLatest: boolean): Promise<core.Dependency>;
27
+ export declare function getVanillaMcdoc(downloader: core.Downloader): Promise<core.Dependency>;
30
28
  //# sourceMappingURL=index.d.ts.map
@@ -102,9 +102,14 @@ function getCacheOptionsBasedOnGitHubCommitSha(owner, repo, ref) {
102
102
  };
103
103
  }
104
104
  /**
105
+ * Download data from a GitHub repository with tags corresponding to Minecraft versions.
106
+ * The downloaded data will be cached based on the commit SHA of the respective tag.
107
+ *
108
+ * If `isLatest` if `true`, instead of finding the tag corresponding to the given version, the default branch will be used.
109
+ *
105
110
  * @returns The URI to the `.tar.gz` file.
106
111
  */
107
- async function downloadGitHubRepo({ defaultBranch, downloader, externals, getTag, repo, isLatest, owner, version }) {
112
+ async function downloadGitHubRepo({ defaultBranch, downloader, getTag, repo, isLatest, owner, version }) {
108
113
  const ref = getGitRef({ defaultBranch, getTag, isLatest, version });
109
114
  const out = {};
110
115
  await downloader.download({
@@ -119,27 +124,28 @@ async function downloadGitHubRepo({ defaultBranch, downloader, externals, getTag
119
124
  }
120
125
  /* istanbul ignore next */
121
126
  /**
122
- * @param version An already resolved version identifier.
123
- *
124
127
  * @throws Network/file system errors.
125
128
  *
126
129
  * @returns
127
130
  * - `startDepth`: The amount of level to skip when unzipping the tarball.
128
131
  * - `uri`: URI to the `.tar.gz` file.
129
132
  */
130
- export async function getVanillaMcdoc(externals, downloader, version, isLatest) {
133
+ export async function getVanillaMcdoc(downloader) {
134
+ const owner = 'SpyglassMC';
135
+ const repo = 'vanilla-mcdoc';
136
+ const ref = 'refs/heads/main';
137
+ const out = {};
138
+ await downloader.download({
139
+ id: 'mc-je/vanilla-mcdoc.tar.gz',
140
+ uri: `https://api.github.com/repos/${owner}/${repo}/tarball/${ref}`,
141
+ transformer: b => b,
142
+ cache: getCacheOptionsBasedOnGitHubCommitSha(owner, repo, ref),
143
+ options: GitHubApiDownloadOptions,
144
+ ttl: DownloaderTtl,
145
+ }, out);
131
146
  return {
132
147
  info: { startDepth: 1 },
133
- uri: await downloadGitHubRepo({
134
- defaultBranch: 'main',
135
- downloader,
136
- externals,
137
- getTag: v => v,
138
- isLatest,
139
- owner: 'SpyglassMC',
140
- repo: 'vanila-mcdoc',
141
- version,
142
- }),
148
+ uri: out.cacheUri,
143
149
  };
144
150
  }
145
151
  //# sourceMappingURL=index.js.map
package/lib/index.js CHANGED
@@ -34,7 +34,7 @@ export const initialize = async (ctx) => {
34
34
  }
35
35
  const packMcmeta = await getPackMcmeta();
36
36
  const { release, id: version, isLatest } = resolveConfiguredVersion(config.env.gameVersion, { packMcmeta, versions });
37
- meta.registerDependencyProvider('@vanilla-mcdoc', () => getVanillaMcdoc(externals, downloader, version, isLatest));
37
+ meta.registerDependencyProvider('@vanilla-mcdoc', () => getVanillaMcdoc(downloader));
38
38
  const summary = await getMcmetaSummary(ctx.externals, downloader, logger, version, isLatest, config.env.dataSource, config.env.mcmetaSummaryOverrides);
39
39
  if (!summary.blocks || !summary.commands || !summary.fluids || !summary.registries) {
40
40
  ctx.logger.error('[je-initialize] Failed loading mcmeta summaries. Expect everything to be broken.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spyglassmc/java-edition",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -17,12 +17,12 @@
17
17
  "release:dry": "npm publish --dry-run"
18
18
  },
19
19
  "dependencies": {
20
- "@spyglassmc/core": "0.3.0",
21
- "@spyglassmc/json": "0.3.0",
20
+ "@spyglassmc/core": "0.4.0",
21
+ "@spyglassmc/json": "0.3.1",
22
22
  "@spyglassmc/locales": "0.3.0",
23
- "@spyglassmc/mcfunction": "0.2.1",
24
- "@spyglassmc/mcdoc": "0.3.0",
25
- "@spyglassmc/nbt": "0.3.0"
23
+ "@spyglassmc/mcfunction": "0.2.2",
24
+ "@spyglassmc/mcdoc": "0.3.1",
25
+ "@spyglassmc/nbt": "0.3.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "fast-glob": "^3.2.5",