@geolonia/embed 6.0.0-pre.4 → 6.0.0-pre.5
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/.github/dependabot.yml +89 -0
- package/.github/workflows/build.yml +84 -32
- package/.pinact.yml +80 -0
- package/.tool-versions +1 -0
- package/CHANGELOG.md +17 -0
- package/README.md +36 -7
- package/dist/embed +1 -1
- package/dist/embed-chunks/00ecbfa5ec913dd002fb.js +2 -0
- package/dist/embed-chunks/{18a79c1f77cc6894d617.js → 4574b15eb540c5efc533.js} +1 -1
- package/dist/embed-chunks/{b50d8f9685823588d639.js → 4b5b1b54a5dac816ef15.js} +1 -1
- package/dist/embed-chunks/52e84382012e7ba206d5.js +2 -0
- package/dist/embed-chunks/{cfb9cc05d697ae310f6a.js → d1fe32cb4bfb0e9c6575.js} +1 -1
- package/dist/embed-chunks/ffdb8e820d823ee3571c.js +1 -0
- package/dist/embed-core.js +2 -1
- package/dist/embed-core.js.LICENSE.txt +4 -0
- package/dist/embed.js +1 -1
- package/dist/embed.js.LICENSE.txt +1 -1
- package/dist/version.d.ts +1 -1
- package/e2e/helper.ts +2 -1
- package/e2e/production-bundle.spec.ts +56 -0
- package/package.json +21 -21
- package/playwright.config.ts +1 -1
- package/pnpm-workspace.yaml +23 -0
- package/src/version.ts +1 -1
- package/webpack.config.js +27 -1
- package/dist/embed-chunks/88308c97950af0326501.js +0 -1
- package/dist/embed-chunks/c22ad704365fc721df0a.js +0 -2
- package/dist/embed-chunks/ec26dd45d3c0fe2695b2.js +0 -2
- /package/dist/embed-chunks/{c22ad704365fc721df0a.js.LICENSE.txt → 00ecbfa5ec913dd002fb.js.LICENSE.txt} +0 -0
- /package/dist/embed-chunks/{ec26dd45d3c0fe2695b2.js.LICENSE.txt → 52e84382012e7ba206d5.js.LICENSE.txt} +0 -0
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "6.0.0-pre.
|
|
1
|
+
export declare const VERSION = "6.0.0-pre.5";
|
package/e2e/helper.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Page } from '@playwright/test';
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const BASE_URL = 'http://localhost:3000';
|
|
4
|
+
export const TEST_URL = `${BASE_URL}/e2e`;
|
|
4
5
|
export const LOAD_TIMEOUT = 5000;
|
|
5
6
|
|
|
6
7
|
/** 地図コンテナと canvas の出現を待つ。既存テスト互換。 */
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { test, expect } from '@playwright/test';
|
|
2
|
+
import { BASE_URL, TEST_URL, mockGeoloniaTiles, waitForStyleLoad } from './helper';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* production 出力 (`dist/embed.js` を docs/ へコピーしたもの) を直接読み込んで検証する。
|
|
6
|
+
*
|
|
7
|
+
* 他の spec が読む `../embed` は dev サーバーが生成するバンドルで、mode も
|
|
8
|
+
* minify も production とは別物。配布するのは production 出力のほうなのに、
|
|
9
|
+
* これまでどこでも実行されていなかった。
|
|
10
|
+
*
|
|
11
|
+
* minify やローダーの更新で production だけが壊れる事故を拾うのが目的。実際
|
|
12
|
+
* #527 の css-loader 7 / style-loader 4 への更新では、production バンドルが
|
|
13
|
+
* CSS を注入できるかを確かめる手段が無く、その場限りのテストを書いて確認していた。
|
|
14
|
+
*/
|
|
15
|
+
const BUNDLE_URL = `${BASE_URL}/embed.js`;
|
|
16
|
+
|
|
17
|
+
test.describe('production バンドル', () => {
|
|
18
|
+
test('地図が描画され、CSS が注入される', async ({ page, request }) => {
|
|
19
|
+
// `docs/embed.js` は .gitignore 対象で、`pnpm run build` でしか作られない。
|
|
20
|
+
// CI は build ジョブの成果物を展開しているので、無ければ設定の不備として落とす。
|
|
21
|
+
const bundle = await request.get(BUNDLE_URL);
|
|
22
|
+
if (!bundle.ok()) {
|
|
23
|
+
if (process.env.CI) {
|
|
24
|
+
throw new Error(
|
|
25
|
+
`${BUNDLE_URL} が ${bundle.status()} を返しました。` +
|
|
26
|
+
'e2e ジョブで build ジョブの成果物が展開されているか確認してください。',
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
test.skip(
|
|
30
|
+
true,
|
|
31
|
+
'`pnpm run build` を実行すると production バンドルの検証が走ります',
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const errors: string[] = [];
|
|
36
|
+
page.on('pageerror', (e) => errors.push(e.message));
|
|
37
|
+
|
|
38
|
+
await mockGeoloniaTiles(page);
|
|
39
|
+
await page.goto(`${TEST_URL}/production-bundle.html`);
|
|
40
|
+
await waitForStyleLoad(page, '#map');
|
|
41
|
+
|
|
42
|
+
await expect(page.locator('#map canvas')).toBeVisible();
|
|
43
|
+
|
|
44
|
+
// style-loader が maplibre の CSS を <style> として注入しているか。
|
|
45
|
+
// ローダーの更新でここが壊れるとコントロール類の見た目だけが崩れ、
|
|
46
|
+
// canvas は出るので気づきにくい。
|
|
47
|
+
const injectedMaplibreCss = await page.evaluate(() =>
|
|
48
|
+
[...document.querySelectorAll('style')].some((s) =>
|
|
49
|
+
s.textContent?.includes('maplibregl-ctrl'),
|
|
50
|
+
),
|
|
51
|
+
);
|
|
52
|
+
expect(injectedMaplibreCss).toBe(true);
|
|
53
|
+
|
|
54
|
+
expect(errors).toEqual([]);
|
|
55
|
+
});
|
|
56
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geolonia/embed",
|
|
3
|
-
"version": "6.0.0-pre.
|
|
3
|
+
"version": "6.0.0-pre.5",
|
|
4
4
|
"description": "Geolonia embed JS API",
|
|
5
5
|
"main": "dist/embed.js",
|
|
6
6
|
"types": "dist/src/embed.d.ts",
|
|
@@ -14,18 +14,6 @@
|
|
|
14
14
|
"default": "./dist/embed-core.js"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
"scripts": {
|
|
18
|
-
"start": "MAP_PLATFORM_STAGE=v1 webpack serve --config ./docs/webpack.config.js",
|
|
19
|
-
"build": "npm run build:version && npm run build:embed",
|
|
20
|
-
"build:version": "node ./scripts/build-version.mjs",
|
|
21
|
-
"build:embed": "MAP_PLATFORM_STAGE=v1 webpack --mode production && cp ./dist/embed.js ./dist/embed && cp -r ./dist/* ./docs/ && rm -rf ./docs/*.d.ts ./docs/lib/",
|
|
22
|
-
"analyze": "ANALYZE=true MAP_PLATFORM_STAGE=v1 webpack --mode production",
|
|
23
|
-
"format": "prettier \"./src/**/*.ts\" --write",
|
|
24
|
-
"lint": "eslint .",
|
|
25
|
-
"test": "vitest run",
|
|
26
|
-
"e2e": "playwright test",
|
|
27
|
-
"docs:api": "typedoc"
|
|
28
|
-
},
|
|
29
17
|
"author": "Geolonia (https://geolonia.com)",
|
|
30
18
|
"repository": {
|
|
31
19
|
"type": "git",
|
|
@@ -40,12 +28,12 @@
|
|
|
40
28
|
"@eslint/compat": "^1.4.1",
|
|
41
29
|
"@eslint/eslintrc": "^3.3.1",
|
|
42
30
|
"@eslint/js": "^9.39.1",
|
|
31
|
+
"@types/geojson": "^7946.0.16",
|
|
43
32
|
"@types/jsdom": "^21.1.7",
|
|
44
33
|
"@types/node": "^24.0.4",
|
|
45
34
|
"@typescript-eslint/eslint-plugin": "^8.46.4",
|
|
46
35
|
"@typescript-eslint/parser": "^8.46.4",
|
|
47
|
-
"
|
|
48
|
-
"css-loader": "^6.7.2",
|
|
36
|
+
"css-loader": "^7.1.5",
|
|
49
37
|
"esbuild": "^0.28.2",
|
|
50
38
|
"eslint": "^9.39.1",
|
|
51
39
|
"eslint-config-prettier": "^10.1.8",
|
|
@@ -57,7 +45,7 @@
|
|
|
57
45
|
"jsdom": "^29.1.1",
|
|
58
46
|
"node-fetch": "2",
|
|
59
47
|
"prettier": "^3.6.2",
|
|
60
|
-
"style-loader": "^
|
|
48
|
+
"style-loader": "^4.0.0",
|
|
61
49
|
"svg-inline-loader": "^0.8.2",
|
|
62
50
|
"ts-loader": "^9.4.3",
|
|
63
51
|
"typedoc": "^0.28.20",
|
|
@@ -65,13 +53,25 @@
|
|
|
65
53
|
"typescript": "^5.1.3",
|
|
66
54
|
"vitest": "^4.1.1",
|
|
67
55
|
"webpack": "^5.75.0",
|
|
68
|
-
"webpack-bundle-analyzer": "^4.
|
|
69
|
-
"webpack-cli": "^
|
|
70
|
-
"webpack-dev-server": "^
|
|
56
|
+
"webpack-bundle-analyzer": "^5.4.0",
|
|
57
|
+
"webpack-cli": "^7.2.3",
|
|
58
|
+
"webpack-dev-server": "^6.0.0"
|
|
71
59
|
},
|
|
72
60
|
"dependencies": {
|
|
73
61
|
"@geolonia/maps-core": "^0.6.0",
|
|
74
62
|
"@playwright/test": "^1.61.1",
|
|
75
|
-
"maplibre-gl": "6.
|
|
63
|
+
"maplibre-gl": "6.12.0"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"start": "MAP_PLATFORM_STAGE=v1 webpack serve --config ./docs/webpack.config.js",
|
|
67
|
+
"build": "pnpm run build:version && pnpm run build:embed",
|
|
68
|
+
"build:version": "node ./scripts/build-version.mjs",
|
|
69
|
+
"build:embed": "MAP_PLATFORM_STAGE=v1 webpack --mode production && cp ./dist/embed.js ./dist/embed && cp -r ./dist/* ./docs/ && rm -rf ./docs/*.d.ts ./docs/lib/",
|
|
70
|
+
"analyze": "ANALYZE=true MAP_PLATFORM_STAGE=v1 webpack --mode production",
|
|
71
|
+
"format": "prettier \"./src/**/*.ts\" --write",
|
|
72
|
+
"lint": "eslint .",
|
|
73
|
+
"test": "vitest run",
|
|
74
|
+
"e2e": "playwright test",
|
|
75
|
+
"docs:api": "typedoc"
|
|
76
76
|
}
|
|
77
|
-
}
|
|
77
|
+
}
|
package/playwright.config.ts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# pnpm の設定ファイル。pnpm 11 以降、これらの設定は .npmrc ではなくここで指定する。
|
|
2
|
+
#
|
|
3
|
+
# ignoreScripts: 依存パッケージのライフサイクルスクリプトを実行しない。
|
|
4
|
+
# 以前は .npmrc の `ignore-scripts=true` で同じことをしていたが、pnpm は .npmrc の
|
|
5
|
+
# この設定を読まないため移設した。設定が無いと pnpm は esbuild のビルドスクリプトを
|
|
6
|
+
# 無視したことを ERR_PNPM_IGNORED_BUILDS として扱い、install が失敗する。
|
|
7
|
+
# esbuild は 0.25 以降プラットフォーム別パッケージを optionalDependencies で解決するので、
|
|
8
|
+
# ビルドスクリプトを実行しなくても動作する。
|
|
9
|
+
ignoreScripts: true
|
|
10
|
+
|
|
11
|
+
# pmOnFail: `packageManager` のバージョン不一致チェックをスキップする
|
|
12
|
+
# (pnpm のドキュメント上は旧 `managePackageManagerVersions: false` 相当)。
|
|
13
|
+
#
|
|
14
|
+
# 既定の `download` だと、pnpm 12 は宣言された pnpm 自身を解決するための
|
|
15
|
+
# "env lockfile" を pnpm-lock.yaml の 1 つ目の YAML ドキュメントとして書く。
|
|
16
|
+
# GitHub の依存グラフの静的パーサーは 1 つ目しか読まないため、グラフには
|
|
17
|
+
# pnpm と @pnpm/exe.* だけが載り、npm パッケージが 1 つも入らなくなる。
|
|
18
|
+
# その結果 Dependabot アラートも届かない (dependabot/dependabot-core#15904)。
|
|
19
|
+
#
|
|
20
|
+
# `ignore` にすると env lockfile が作られず lock は単一ドキュメントに戻るので、
|
|
21
|
+
# パーサーが実依存を読めるようになる。
|
|
22
|
+
# CI は pnpm/action-setup が packageManager を読んで版を揃えるため影響はない。
|
|
23
|
+
pmOnFail: ignore
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '6.0.0-pre.
|
|
1
|
+
export const VERSION = '6.0.0-pre.5';
|
package/webpack.config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|
3
|
-
const { DefinePlugin } = require('webpack');
|
|
3
|
+
const { BannerPlugin, DefinePlugin } = require('webpack');
|
|
4
4
|
const esbuild = require('esbuild');
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -27,11 +27,37 @@ const bundleMaplibreWorkerSource = () => {
|
|
|
27
27
|
return result.outputFiles[0].text;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* バンドルした maplibre-gl のライセンス表記。
|
|
32
|
+
*
|
|
33
|
+
* maplibre-gl のソース先頭には `@license` コメントがあり、通常は terser の
|
|
34
|
+
* extractComments が `<bundle>.js.LICENSE.txt` へ切り出す。ただし terser はコメント単体
|
|
35
|
+
* ではなく「コメントが付いているコード」を基準に扱うため、そのコードが削除・並べ替えされると
|
|
36
|
+
* コメントごと消え、extractComments まで届かない。
|
|
37
|
+
*
|
|
38
|
+
* embed.js は `Object.assign(..., maplibregl, ...)` で名前空間を丸ごと使うので偶然残るが、
|
|
39
|
+
* embed-core.js は一部のシンボルしか使わないため消える。実際 6.0.0-pre.4 の
|
|
40
|
+
* `dist/embed-core.js` は maplibre を同梱しながらライセンス表記が無い状態で公開された
|
|
41
|
+
* (6.0.0-pre.3 までは残っていた)。偶然に頼らず明示する。
|
|
42
|
+
*
|
|
43
|
+
* バージョンは maplibre-gl から読むので手で追従する必要はない。maplibre を同梱しなくなったら
|
|
44
|
+
* この banner も外すこと。
|
|
45
|
+
*/
|
|
46
|
+
const maplibreLicenseBanner = `/**
|
|
47
|
+
* MapLibre GL JS
|
|
48
|
+
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v${require('maplibre-gl/package.json').version}/LICENSE.txt
|
|
49
|
+
*/`;
|
|
50
|
+
|
|
30
51
|
const plugins = [
|
|
31
52
|
new DefinePlugin({
|
|
32
53
|
'process.env.MAP_PLATFORM_STAGE': JSON.stringify(process.env.MAP_PLATFORM_STAGE || 'dev'),
|
|
33
54
|
__MAPLIBRE_WORKER_SOURCE__: JSON.stringify(bundleMaplibreWorkerSource()),
|
|
34
55
|
}),
|
|
56
|
+
new BannerPlugin({
|
|
57
|
+
banner: maplibreLicenseBanner,
|
|
58
|
+
raw: true,
|
|
59
|
+
entryOnly: true,
|
|
60
|
+
}),
|
|
35
61
|
];
|
|
36
62
|
if (process.env.ANALYZE === 'true') {
|
|
37
63
|
plugins.push(new BundleAnalyzerPlugin());
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunkgeoloniaEmbedCore=self.webpackChunkgeoloniaEmbedCore||[]).push([[445],{9746(){},9977(){},197(){},1866(){},2739(){}}]);
|