@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 +71 -0
- package/package.json +1 -1
- package/tsconfig.json +1 -0
- package/vite.config-es.ts +1 -0
- package/vite.config-umd.ts +12 -0
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
package/tsconfig.json
CHANGED
package/vite.config-es.ts
CHANGED
package/vite.config-umd.ts
CHANGED
|
@@ -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: {
|