material-web/package.json

193 lines
4.4 KiB
JSON
Raw Normal View History

{
"name": "@material/web",
2024-05-23 20:03:00 +03:00
"version": "1.5.0",
"publishConfig": {
"access": "public"
},
"description": "Material web components",
"keywords": [
"material",
"material design",
"design system",
"components",
"web components",
"lit"
],
"repository": {
"type": "git",
"url": "git+https://github.com/material-components/material-web.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/material-components/material-web/issues"
},
"homepage": "https://github.com/material-components/material-web#readme",
"scripts": {
2022-11-16 00:35:16 +03:00
"build": "wireit",
"build:ts": "wireit",
"build:css-to-ts": "wireit",
"build:sass": "wireit",
"test": "wireit",
"build:catalog": "wireit",
2023-12-13 04:25:03 +03:00
"build:scripts": "wireit",
"update-docs": "wireit",
"update-size": "wireit"
},
"type": "module",
chore: Don't publish .ts or testing files Before this change, we publish .ts source files to the same directory as the .js/.d.ts files to npm. That means when a consumer imports a @material/web module with TypeScript, TypeScript prefers the .ts file over the .d.ts file when to load that module's types. That in turn means the consumer's TypeScript type-checks the entire @material/web .ts file, including its private implementation details (private fields, etc.). If the consumer's tsconfig.json is configured more strictly than @material/web's was (e.g. if noUnusedParameters is true), or if some additional ambient types are loaded (e.g. @types/node is installed, which changes the signature of setTimeout), they would get a compile error. This change stops publishing .ts files to npm to solve that problem for consumers. This also includes some related changes: - Sets inlineSources to true. This puts the .ts file contents directly inside the .js.map file, instead of linking to the .ts path. Otherwise sourcemaps would not work. - Sets declarationMap to false. This removes the .d.ts.map files, which are not useful without the .ts paths, because there is no equivalent to inlineSources for declarationMap (see https://github.com/microsoft/TypeScript/issues/38966). - Replaces .npmignore blocklist with package.json files allowlist (which I find to be a bit safer), and adds new omissions for testing files, which don't need to be published. Note that this doesn't solve the problem when using "npm link" for local cross-package development, because in that case the .ts files will still be present. So a better solution to this problem would be to have a separate src/ directory for .ts source files. That will require a Copybara transform to move the files. We can discuss this separately and do it as a followup if agreed. PiperOrigin-RevId: 469833263
2022-08-25 01:03:43 +03:00
"files": [
"**/*.js",
"**/*.js.map",
"**/*.d.ts",
"**/*.scss",
"**/*.css",
"**/*.css.map",
"!web-test-runner.config.js",
"!commitlint.config.js",
chore: Don't publish .ts or testing files Before this change, we publish .ts source files to the same directory as the .js/.d.ts files to npm. That means when a consumer imports a @material/web module with TypeScript, TypeScript prefers the .ts file over the .d.ts file when to load that module's types. That in turn means the consumer's TypeScript type-checks the entire @material/web .ts file, including its private implementation details (private fields, etc.). If the consumer's tsconfig.json is configured more strictly than @material/web's was (e.g. if noUnusedParameters is true), or if some additional ambient types are loaded (e.g. @types/node is installed, which changes the signature of setTimeout), they would get a compile error. This change stops publishing .ts files to npm to solve that problem for consumers. This also includes some related changes: - Sets inlineSources to true. This puts the .ts file contents directly inside the .js.map file, instead of linking to the .ts path. Otherwise sourcemaps would not work. - Sets declarationMap to false. This removes the .d.ts.map files, which are not useful without the .ts paths, because there is no equivalent to inlineSources for declarationMap (see https://github.com/microsoft/TypeScript/issues/38966). - Replaces .npmignore blocklist with package.json files allowlist (which I find to be a bit safer), and adds new omissions for testing files, which don't need to be published. Note that this doesn't solve the problem when using "npm link" for local cross-package development, because in that case the .ts files will still be present. So a better solution to this problem would be to have a separate src/ directory for .ts source files. That will require a Copybara transform to move the files. We can discuss this separately and do it as a followup if agreed. PiperOrigin-RevId: 469833263
2022-08-25 01:03:43 +03:00
"!**/test/**",
2022-11-16 00:35:16 +03:00
"!**/*_test.*",
2023-06-14 01:42:07 +03:00
"!.wireit/**",
"!catalog/",
"!scripts/",
"!**/testing/**",
"testing/harness.{js,js.map,d.ts}",
"testing/transform-pseudo-classes.{js,js.map,d.ts}"
],
2023-09-27 00:49:18 +03:00
"workspaces": [
"catalog"
],
"dependencies": {
"lit": "^2.7.4 || ^3.0.0",
"tslib": "^2.4.0"
},
"devDependencies": {
2024-06-05 07:57:37 +03:00
"@lit-labs/analyzer": "^0.12.1",
2023-12-13 04:25:03 +03:00
"@rollup/plugin-multi-entry": "^6.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@types/jasmine": "^4.0.3",
"@web/test-runner": "^0.18.2",
2022-11-30 03:08:45 +03:00
"@web/test-runner-playwright": "^0.9.0",
2022-11-30 03:57:05 +03:00
"jasmine": "^4.5.0",
2023-12-13 04:25:03 +03:00
"rollup": "^2.79.1",
"sass": "^1.52.3",
"sass-true": "^6.1.0",
2023-09-08 22:10:45 +03:00
"typescript": "5.1.6",
"web-test-runner-jasmine": "^0.0.6",
"wireit": "^0.13.0"
2022-11-16 00:35:16 +03:00
},
"wireit": {
"build": {
2023-09-27 00:49:18 +03:00
"dependencies": [
"build:ts"
]
2022-11-16 00:35:16 +03:00
},
"build:ts": {
"command": "tsc --pretty",
"files": [
"tsconfig.json",
"**/*.ts",
"!**/*.d.ts",
"!**/*-styles.ts",
"!catalog/",
"!scripts/"
2022-11-16 00:35:16 +03:00
],
"output": [
".tsbuildinfo",
"**/*.js",
"**/*.js.map",
"**/*.d.ts",
"!web-test-runner.config.js",
"!commitlint.config.js",
"!types/",
"!catalog/",
"!scripts/"
2022-11-16 00:35:16 +03:00
],
"clean": "if-file-deleted",
2023-09-27 00:49:18 +03:00
"dependencies": [
"build:css-to-ts"
]
2022-11-16 00:35:16 +03:00
},
"build:css-to-ts": {
"command": "find . \\( -path ./.wireit -o -path ./node_modules -o -path ./catalog \\) -prune -o -name '*-styles.css' -print | xargs -L1 node scripts/css-to-ts.js",
2023-09-27 00:49:18 +03:00
"files": [
"**/*-styles.css",
"!catalog/"
2023-09-27 00:49:18 +03:00
],
"output": [
"**/*-styles.ts",
"!catalog/"
2023-09-27 00:49:18 +03:00
],
"dependencies": [
"build:scripts",
2023-09-27 00:49:18 +03:00
"build:sass"
]
2022-11-16 00:35:16 +03:00
},
"build:sass": {
2023-06-28 22:03:21 +03:00
"command": "sass --style=compressed --load-path=node_modules --load-path=node_modules/sass-true/sass $(ls -d */ | grep -vE 'node_modules|catalog')",
2023-09-27 00:49:18 +03:00
"files": [
"**/*.scss",
"!catalog/"
2023-09-27 00:49:18 +03:00
],
"output": [
"**/*.css",
"**/*.css.map",
"!catalog/"
2023-09-27 00:49:18 +03:00
]
},
"test": {
"command": "wtr",
2023-09-27 00:49:18 +03:00
"dependencies": [
"build:ts"
],
"files": [
"web-test-runner.config.js"
],
"output": []
},
"build:catalog": {
2023-09-27 00:49:18 +03:00
"dependencies": [
"./catalog:build:prod"
]
},
2023-12-13 04:25:03 +03:00
"build:scripts": {
"command": "tsc -b scripts/tsconfig.json --pretty",
"files": [
"scripts/tsconfig.json",
2023-12-13 04:25:03 +03:00
"scripts/**/*.ts",
"!**/*.d.ts",
"!**/*-styles.ts"
],
"output": [
"scripts/.tsbuildinfo",
2023-12-13 04:25:03 +03:00
"scripts/**/*.js",
"scripts/**/*.js.map",
"scripts/**/*.d.ts"
],
"clean": "if-file-deleted"
},
"update-docs": {
"command": "node scripts/analyzer/update-docs.js",
"files": [
"docs/components/*.md",
"**/*.ts",
"!**/*.d.ts",
"!**/*-styles.ts",
"!catalog/",
"!scripts/",
"scripts/analyzer/update-docs.js"
],
"output": [],
2023-09-27 00:49:18 +03:00
"dependencies": [
2023-12-13 04:25:03 +03:00
"build:scripts"
]
},
"update-size": {
"command": "node scripts/size/update-size.js",
"dependencies": [
"build:scripts",
"build"
2023-09-27 00:49:18 +03:00
]
2022-11-16 00:35:16 +03:00
}
}
}