@maptiler/sdk 3.4.0-rc1 → 3.4.0-rc2

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/eslint.config.mjs CHANGED
@@ -8,6 +8,77 @@ export default tseslint.config(
8
8
  tseslint.configs.strictTypeChecked,
9
9
  tseslint.configs.stylisticTypeChecked,
10
10
  tseslint.configs.recommendedTypeChecked,
11
+ {
12
+ // forked from https://www.npmjs.com/package/eslint-plugin-restrict-imports
13
+ plugins: {
14
+ import: {
15
+ rules: {
16
+ "default-imports-only": {
17
+ meta: {
18
+ type: "suggestion",
19
+ docs: {},
20
+ schema: [
21
+ {
22
+ bannedImport: {
23
+ locations: ["filePaths"],
24
+ message: "string",
25
+ fixedLocation: "string",
26
+ },
27
+ },
28
+ ],
29
+ },
30
+ create: function (context) {
31
+ const filePath = context.getFilename();
32
+ const options = context.options[0] || {
33
+ "^/(.*)": {
34
+ locations: ["(.*)"],
35
+ },
36
+ };
37
+
38
+ return {
39
+ ImportDeclaration: (node) => {
40
+ Object.entries(options).forEach(([bannedImport, config]) => {
41
+ const importLocationRegex = new RegExp(bannedImport);
42
+
43
+ if (config.ignoreTypeImports && node.importKind === "type") return;
44
+
45
+ if (importLocationRegex.test(node.source.value)) {
46
+ config.locations.forEach((fp) => {
47
+ const bannedLocationRegex = new RegExp(fp);
48
+
49
+ if (bannedLocationRegex.test(filePath)) {
50
+ node.specifiers.forEach((specifier) => {
51
+ if (specifier.type !== "ImportDefaultSpecifier") {
52
+ context.report({
53
+ message: config.message ?? `Importing from '${bannedImport}' is banned in '${fp}'`,
54
+ node,
55
+ });
56
+ }
57
+ });
58
+ }
59
+ });
60
+ }
61
+ });
62
+ },
63
+ };
64
+ },
65
+ },
66
+ },
67
+ },
68
+ },
69
+ rules: {
70
+ "import/default-imports-only": [
71
+ "error",
72
+ {
73
+ "maplibre-gl$": {
74
+ locations: ["^(?!.*\.d\.ts$).*\.((ts|js))$"],
75
+ message: `Maplibre-gl uses CJS modules, only default imports are supported, named imports may fail on some setups.`,
76
+ ignoreTypeImports: true,
77
+ },
78
+ },
79
+ ],
80
+ },
81
+ },
11
82
  {
12
83
  languageOptions: {
13
84
  parserOptions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maptiler/sdk",
3
- "version": "3.4.0-rc1",
3
+ "version": "3.4.0-rc2",
4
4
  "description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud",
5
5
  "author": "MapTiler",
6
6
  "module": "dist/maptiler-sdk.mjs",
package/tsconfig.json CHANGED
@@ -28,6 +28,7 @@
28
28
  "src",
29
29
  "e2e",
30
30
  "./eslint.config.mjs",
31
+ "test",
31
32
  "./vite.config-test.ts",
32
33
  "./vite.config-e2e.ts",
33
34
  "./playwright.config.ts",
package/vite.config-es.ts CHANGED
@@ -29,6 +29,7 @@ export default defineConfig({
29
29
  // make sure to externalize deps that shouldn't be bundled
30
30
  // into your library
31
31
  external: [
32
+ "./e2e/",
32
33
  "maplibre-gl",
33
34
  "@maptiler/client",
34
35
  "@mapbox/point-geometry",
@@ -16,6 +16,18 @@ export default defineConfig({
16
16
  name: 'maptilersdk',
17
17
  fileName: (format, entryName) => "maptiler-sdk.umd.min.js",
18
18
  formats: ['umd'],
19
+ },
20
+ rollupOptions: {
21
+ // make sure to externalize deps that shouldn't be bundled
22
+ // into your library
23
+ external: [
24
+ "./e2e",
25
+ ],
26
+ output: {
27
+ // Provide global variables to use in the UMD build
28
+ // for externalized deps
29
+ globals: {},
30
+ },
19
31
  }
20
32
  },
21
33
  define: {