material-web/package.json

137 lines
2.9 KiB
JSON
Raw Normal View History

{
"name": "@material/web",
2023-09-06 23:16:50 +03:00
"version": "1.0.0-pre.17",
"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"
},
"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-to-ts.js",
"!web-test-runner.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/**",
"!**/testing/**",
2022-11-16 00:35:16 +03:00
"!**/*_test.*",
2023-06-14 01:42:07 +03:00
"!.wireit/**",
"!catalog"
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
],
"workspaces": [
"catalog"
],
"dependencies": {
"lit": "^2.7.4 || ^3.0.0",
"tslib": "^2.4.0"
},
"devDependencies": {
"@types/jasmine": "^4.0.3",
2022-11-30 03:08:45 +03:00
"@web/test-runner": "^0.15.0",
"@web/test-runner-playwright": "^0.9.0",
2022-11-30 03:57:05 +03:00
"jasmine": "^4.5.0",
"sass": "^1.52.3",
"sass-true": "^6.1.0",
2023-02-17 21:30:14 +03:00
"typescript": "4.9.4",
2022-11-30 03:08:45 +03:00
"web-test-runner-jasmine": "^0.0.2",
2022-11-30 03:57:05 +03:00
"wireit": "^0.9.0"
2022-11-16 00:35:16 +03:00
},
"wireit": {
"build": {
"dependencies": [
"build:ts"
]
},
"build:ts": {
"command": "tsc --pretty",
"files": [
"tsconfig.json",
"**/*.ts",
"!**/*.d.ts",
"!**/*.css.ts",
"!catalog"
2022-11-16 00:35:16 +03:00
],
"output": [
".tsbuildinfo",
"**/*.js",
"**/*.js.map",
"**/*.d.ts",
"!css-to-ts.js",
"!web-test-runner.config.js",
"!types/",
"!catalog"
2022-11-16 00:35:16 +03:00
],
"clean": "if-file-deleted",
"dependencies": [
"build:css-to-ts"
]
},
"build:css-to-ts": {
"command": "find . \\( -path ./.wireit -o -path ./node_modules -o -path ./catalog \\) -prune -o -name '*.css' -print | xargs node css-to-ts.js",
2022-11-16 00:35:16 +03:00
"files": [
"css-to-ts.js"
],
"output": [
"**/*.css.ts",
"!catalog"
2022-11-16 00:35:16 +03:00
],
"dependencies": [
"build:sass"
]
},
"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')",
2022-11-16 00:35:16 +03:00
"files": [
2023-06-28 21:18:37 +03:00
"**/*.scss",
"!catalog"
2022-11-16 00:35:16 +03:00
],
"output": [
"**/*.css",
"**/*.css.map",
"!catalog"
2022-11-16 00:35:16 +03:00
]
},
"test": {
"command": "wtr",
"dependencies": [
"build:ts"
],
"files": [
"web-test-runner.config.js"
],
"output": []
},
"build:catalog": {
"dependencies": [
"./catalog:build:prod"
]
2022-11-16 00:35:16 +03:00
}
}
}